예제 #1
0
 private void ReadDescriptionHeaderBlock(BinaryReader reader, ref DescriptionHeaderBlock descriptionHeader)
 {
     byte[] buffer = reader.ReadBytes(4000);
     descriptionHeader.NameOFLightSource = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.ManufacturerOfLightSource = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.CreatorofOpticalLightSourceModel = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.CreatorOfRayFile = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.Equipment_Software_Used = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.CameraInformation = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.LightSourceOperationInformation = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.AdditionalInformation = Encoding.UTF32.GetString(buffer);
     buffer = reader.ReadBytes(4000);
     descriptionHeader.DataReferencetoSourceGeometry = Encoding.UTF32.GetString(buffer);
 }
예제 #2
0
        public IESTM25File(string fileName, ulong numrays)
        {
            using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
            {
                FileHeaderBlock fileHeader = new FileHeaderBlock();
                ReadHeaderBlock(reader, ref fileHeader);
                if (!fileHeader.CheckHeaderBlockisValid())
                {
                    throw new InvalidTM25Exception("Header Block Not Correct Size", "");
                }
                FileHeader = fileHeader;

                KnownDataFlagBlock knownDataFlag = new KnownDataFlagBlock();
                ReadDataFlagBlock(reader, ref knownDataFlag);
                if (!knownDataFlag.CheckKnownDataFlagBlockisValid())
                {
                    throw new InvalidTM25Exception("Data Flag Block Not Correct Size", "");
                }
                DataFlags = knownDataFlag;

                DescriptionHeaderBlock descriptionHeader = new DescriptionHeaderBlock();
                ReadDescriptionHeaderBlock(reader, ref descriptionHeader);
                if (!descriptionHeader.CheckDescriptionBlockisValid())
                {
                    throw new InvalidTM25Exception("Description Header Block is Not Correct Size", "");
                }
                DescriptionHeader = descriptionHeader;

                if (FileHeader.NumberOfSpectralTables > 0)
                {
                    SpectralTableBlock spectralTables = new SpectralTableBlock();
                    spectralTables.SpectralTables = new List <SpectralTable>();
                    ReadSpectralTableBlock(reader, ref spectralTables);
                    if (!spectralTables.CheckSpectralTableisValid())
                    {
                        throw new InvalidTM25Exception("Spectral Table Block is Not Correct Size", "");
                    }
                    SpectralTables = spectralTables;
                }

                if (FileHeader.NumberOfAdditionalRayDataItemsPerRay > 0)
                {
                    AdditionalRayDataColumnLabelsBlock columnLabelsBlock = new AdditionalRayDataColumnLabelsBlock();
                    ReadColumnsLabelsBlock(reader, ref columnLabelsBlock);
                    if (!columnLabelsBlock.CheckAdditionalRayDataColumnisValid())
                    {
                        throw new InvalidTM25Exception("Additional Ray Data Columns Block is incorrect");
                    }
                    AdditionalRayDataColumnLabels = columnLabelsBlock;
                }

                if (FileHeader.SizeOfAdditionalTextBlock > 0)
                {
                    AdditionalTextBlock additionalTextBlock = new AdditionalTextBlock();
                    ReadAdditionalTextBlock(reader, ref additionalTextBlock);
                    AdditionalText = additionalTextBlock;
                }

                RayDataLinesBlock rayDataLines = new RayDataLinesBlock();
                rayDataLines.Rays = new float[FileHeader.NumberOfRays][];
                ReadPartialRayDataBlock(reader, ref rayDataLines, numrays);
                rayDataLines.RayDataMembers = TM25HelperFunctions.GetListofRayDataFieldsPresent(DataFlags, FileHeader, AdditionalRayDataColumnLabels);
                RayData = rayDataLines;
            }
        }