1 /*=========================================================================
4 Module: $RCSfile: gdcmFile.h,v $
6 Date: $Date: 2005/01/11 15:15:38 $
7 Version: $Revision: 1.93 $
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 =========================================================================*/
30 class PixelReadConvert;
31 class PixelWriteConvert;
32 class DocEntryArchive;
33 //-----------------------------------------------------------------------------
35 * \brief In addition to Dicom Header exploration, this class is designed
36 * for accessing the image/volume content. One can also use it to
37 * write Dicom/ACR-NEMA/RAW files.
39 class GDCM_EXPORT File : public Base
50 File( Header *header );
51 File( std::string const &filename );
55 void Print(std::ostream &os = std::cout);
57 /// Accessor to \ref Header
58 Header *GetHeader() { return HeaderInternal; }
60 size_t GetImageDataSize();
61 size_t GetImageDataRawSize();
63 uint8_t *GetImageData();
64 uint8_t *GetImageDataRaw();
65 size_t GetImageDataIntoVector(void *destination, size_t maxSize);
67 void SetImageData(uint8_t *data, size_t expectedSize);
70 void SetUserData(uint8_t *data, size_t expectedSize);
71 uint8_t* GetUserData();
72 size_t GetUserDataSize();
73 // RBG datas (from file
74 uint8_t* GetRGBData();
75 size_t GetRGBDataSize();
76 // RAW datas (from file
77 uint8_t* GetRawData();
78 size_t GetRawDataSize();
80 // Write pixels of ONE image on hard drive
81 // No test is made on processor "endianity"
82 // The user must call his reader correctly
83 bool WriteRawData (std::string const &fileName);
84 bool WriteDcmImplVR(std::string const &fileName);
85 bool WriteDcmExplVR(std::string const &fileName);
86 bool WriteAcr (std::string const &fileName);
87 bool Write (std::string const &fileName);
89 bool SetEntry(std::string const &content,
90 uint16_t group, uint16_t element);
91 bool SetEntry(uint8_t *content, int lgth,
92 uint16_t group, uint16_t element);
93 bool ReplaceOrCreate(std::string const &content,
94 uint16_t group, uint16_t element);
95 bool ReplaceOrCreate(uint8_t *binArea, int lgth,
96 uint16_t group, uint16_t element);
98 uint8_t* GetLutRGBA();
101 void SetWriteModeToRaw() { SetWriteMode(WMODE_RAW); };
102 void SetWriteModeToRGB() { SetWriteMode(WMODE_RGB); };
103 void SetWriteMode(FileMode mode) { WriteMode = mode; };
104 FileMode GetWriteMode() { return WriteMode; };
107 void SetWriteTypeToDcmImplVR() { SetWriteType(ImplicitVR); };
108 void SetWriteTypeToDcmExplVR() { SetWriteType(ExplicitVR); };
109 void SetWriteTypeToAcr() { SetWriteType(ACR); };
110 void SetWriteTypeToAcrLibido() { SetWriteType(ACR_LIBIDO); };
111 void SetWriteType(FileType format) { WriteType = format; };
112 FileType GetWriteType() { return WriteType; };
115 bool CheckWriteIntegrity();
117 void SetWriteToRaw();
118 void SetWriteToRGB();
121 void SetWriteFileTypeToACR();
122 void SetWriteFileTypeToExplicitVR();
123 void SetWriteFileTypeToImplicitVR();
124 void RestoreWriteFileType();
126 void SetWriteToLibido();
127 void SetWriteToNoLibido();
128 void RestoreWriteOfLibido();
130 ValEntry *CopyValEntry(uint16_t group,uint16_t element);
131 BinEntry *CopyBinEntry(uint16_t group,uint16_t element);
138 // members variables:
139 /// Header to use to load the file
140 Header *HeaderInternal;
142 /// \brief Whether the underlying \ref Header was loaded by
143 /// the constructor or passed to the constructor. When false
144 /// the destructor is in charge of deletion.
147 /// Wether already parsed or not
150 /// Utility pixel converter
151 PixelReadConvert *PixelReadConverter;
152 PixelWriteConvert *PixelWriteConverter;
154 // Utility header archive
155 DocEntryArchive *Archive;
161 } // end namespace gdcm
163 //-----------------------------------------------------------------------------