1 /*=========================================================================
4 Module: $RCSfile: gdcmFile.h,v $
6 Date: $Date: 2004/12/04 09:41:02 $
7 Version: $Revision: 1.84 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
22 #include "gdcmCommon.h"
29 class PixelReadConvert;
30 class PixelWriteConvert;
31 class DocEntryArchive;
32 //-----------------------------------------------------------------------------
34 * In addition to Dicom header exploration, this class is designed
35 * for accessing the image/volume content. One can also use it to
36 * write Dicom/ACR-NEMA/RAW files.
38 class GDCM_EXPORT File
48 File( Header* header );
49 File( std::string const& filename );
53 /// Accessor to \ref Header
54 Header* GetHeader() { return HeaderInternal; }
56 size_t GetImageDataSize();
57 size_t GetImageDataRawSize();
59 uint8_t* GetImageData();
60 uint8_t* GetImageDataRaw();
61 size_t GetImageDataIntoVector(void* destination, size_t maxSize);
63 bool SetImageData (uint8_t* data, size_t expectedSize);
65 // Write pixels of ONE image on hard drive
66 // No test is made on processor "endianity"
67 // The user must call his reader correctly
68 bool WriteRawData (std::string const& fileName);
69 bool WriteDcmImplVR(std::string const& fileName);
70 bool WriteDcmExplVR(std::string const& fileName);
71 bool WriteAcr (std::string const& fileName);
72 bool Write(std::string const& fileName);
74 bool SetEntryByNumber(std::string const& content,
75 uint16_t group, uint16_t element);
76 uint8_t* GetLutRGBA();
79 void SetWriteModeToDecompressed() { SetWriteMode(WMODE_DECOMPRESSED); };
80 void SetWriteModeToRGB() { SetWriteMode(WMODE_RGB); };
81 void SetWriteMode(FileMode mode) { WriteMode = mode; };
82 FileMode GetWriteMode() { return WriteMode; };
85 void SetWriteTypeToDcmImplVR() { SetWriteType(ImplicitVR); };
86 void SetWriteTypeToDcmExplVR() { SetWriteType(ExplicitVR); };
87 void SetWriteTypeToAcr() { SetWriteType(ACR); };
88 void SetWriteTypeToAcrLibido() { SetWriteType(ACR_LIBIDO); };
89 void SetWriteType(FileType format) { WriteType = format; };
90 FileType GetWriteType() { return WriteType; };
93 bool WriteBase(std::string const& fileName);
94 bool CheckWriteIntegrity();
96 void SetWriteToDecompressed();
100 void SetWriteFileTypeToACR();
101 void SetWriteFileTypeToExplicitVR();
102 void SetWriteFileTypeToImplicitVR();
103 void RestoreWriteFileType();
105 void SetWriteToLibido();
106 void SetWriteToNoLibido();
107 void RestoreWriteOfLibido();
109 ValEntry* CopyValEntry(uint16_t group,uint16_t element);
110 BinEntry* CopyBinEntry(uint16_t group,uint16_t element);
115 uint8_t* GetDecompressed();
116 int ComputeDecompressedPixelDataSizeFromHeader();
119 // members variables:
121 /// Header to use to load the file
122 Header *HeaderInternal;
124 /// \brief Whether the underlying \ref Header was loaded by
125 /// the constructor or passed to the constructor. When false
126 /// the destructor is in charge of deletion.
129 /// Wether already parsed or not
132 /// Utility pixel converter
133 PixelReadConvert* PixelReadConverter;
134 PixelWriteConvert* PixelWriteConverter;
136 // Utility header archive
137 DocEntryArchive *Archive;
143 } // end namespace gdcm
145 //-----------------------------------------------------------------------------