00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GDCMFILE_H
00020 #define GDCMFILE_H
00021
00022 #include "gdcmDebug.h"
00023 #include "gdcmDocument.h"
00024
00025
00026
00027 namespace gdcm
00028 {
00029
00030 class RLEFramesInfo;
00031 class JPEGFragmentsInfo;
00032
00033
00034
00035 enum ModalityType {
00036 Unknow,
00037 AU,
00038 AS,
00039 BI,
00040 CF,
00041 CP,
00042 CR,
00043 CS,
00044 CT,
00045 DD,
00046 DF,
00047 DG,
00048 DM,
00049 DS,
00050 DX,
00051 ECG,
00052 EPS,
00053 ES,
00054 FA,
00055 FS,
00056 HC,
00057 HD,
00058 LP,
00059 LS,
00060 MA,
00061 MR,
00062 NM,
00063 OT,
00064 PT,
00065 RF,
00066 RG,
00067 RTDOSE,
00068 RTIMAGE,
00069 RTPLAN,
00070 RTSTRUCT,
00071 SM,
00072 ST,
00073 TG,
00074 US,
00075 VF,
00076 XA,
00077 XC
00078 };
00079
00080
00081
00099 class GDCM_EXPORT File : public Document
00100 {
00101 gdcmTypeMacro(File);
00102
00103 public:
00104 static File *New() {return new File();}
00105
00106
00107
00108 bool Load();
00109
00110 bool IsReadable();
00111
00112
00113 int GetImageNumber();
00114 ModalityType GetModality();
00115
00116 int GetXSize();
00117 int GetYSize();
00118 int GetZSize();
00119
00120 float GetXSpacing();
00121 float GetYSpacing();
00122 float GetZSpacing();
00123
00124 float GetXOrigin();
00125 float GetYOrigin();
00126 float GetZOrigin();
00127
00128 bool GetImageOrientationPatient( float iop[6] );
00129
00130 int GetBitsStored();
00131 int GetBitsAllocated();
00132 int GetHighBitPosition();
00133 int GetSamplesPerPixel();
00134 int GetPlanarConfiguration();
00135 int GetPixelSize();
00136 std::string GetPixelType();
00137 bool IsSignedPixelData();
00138 bool IsMonochrome();
00139 bool IsMonochrome1();
00140 bool IsPaletteColor();
00141 bool IsYBRFull();
00142
00143 bool HasLUT();
00144 int GetLUTNbits();
00145
00146
00147 float GetRescaleIntercept();
00148 float GetRescaleSlope();
00149
00150 int GetNumberOfScalarComponents();
00151 int GetNumberOfScalarComponentsRaw();
00152
00154 uint16_t GetGrPixel() { return GrPixel; }
00156 uint16_t GetNumPixel() { return NumPixel; }
00157
00158 size_t GetPixelOffset();
00159 size_t GetPixelAreaLength();
00160
00162 RLEFramesInfo *GetRLEInfo() { return RLEInfo; }
00164 JPEGFragmentsInfo *GetJPEGInfo() { return JPEGInfo; }
00165
00166
00167 void AddAnonymizeElement (uint16_t group, uint16_t elem,
00168 std::string const &value);
00170 void ClearAnonymizeList() { UserAnonymizeList.clear(); }
00171 void AnonymizeNoLoad();
00173 bool AnonymizeFile();
00174
00175 bool Write(std::string fileName, FileType filetype);
00176
00177
00178 protected:
00179 File();
00180 ~File();
00182 bool MayIWrite(uint16_t group)
00183 { if (group < 8 && group !=2 ) return false; else return true; }
00184
00186 RLEFramesInfo *RLEInfo;
00188 JPEGFragmentsInfo *JPEGInfo;
00189
00194 uint16_t NumPixel;
00199 uint16_t GrPixel;
00200
00201 private:
00202 bool DoTheLoadingJob();
00203 void ComputeRLEInfo();
00204 void ComputeJPEGFragmentInfo();
00205 bool ReadTag(uint16_t, uint16_t);
00206 uint32_t ReadTagLength(uint16_t, uint16_t);
00207 void ReadEncapsulatedBasicOffsetTable();
00208 uint32_t *BasicOffsetTableItemValue;
00209
00210 };
00211 }
00212
00213
00214 #endif