00001
00002
00003 #ifndef GDCMFILE_H
00004 #define GDCMFILE_H
00005
00006 #include "gdcmCommon.h"
00007 #include "gdcmHeader.h"
00008
00009
00010
00011
00012
00013
00014
00015 class GDCM_EXPORT gdcmFile
00016 {
00017 public:
00018 gdcmFile(gdcmHeader *header);
00019 gdcmFile(std::string & filename);
00020 gdcmFile(const char * filename);
00021 virtual ~gdcmFile(void);
00022
00023 gdcmHeader *GetHeader(void);
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 void SetPixelDataSizeFromHeader(void);
00035 size_t GetImageDataSize();
00036 size_t GetImageDataSizeRaw();
00037
00038 void * GetImageData();
00039 size_t GetImageDataIntoVector(void* destination, size_t MaxSize);
00040 void * GetImageDataRaw();
00041 size_t GetImageDataIntoVectorRaw(void* destination, size_t MaxSize);
00042
00043
00044
00045
00046
00047
00048
00049
00050 bool SetImageData (void * Data, size_t ExpectedSize);
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 bool WriteRawData (std::string fileName);
00063 bool WriteDcmImplVR(std::string fileName);
00064 bool WriteDcmImplVR(const char * fileName);
00065 bool WriteDcmExplVR(std::string fileName);
00066 bool WriteAcr (std::string fileName);
00067
00068
00069 bool ParsePixelData(void);
00070
00071 protected:
00072 bool WriteBase(std::string FileName, FileType type);
00073
00074 private:
00075 void SwapZone(void* im, int swap, int lgr, int nb);
00076
00077 bool ReadPixelData(void * destination);
00078
00079
00080 bool gdcm_read_JPEG_file (FILE *fp,void * image_buffer);
00081 static int gdcm_read_RLE_fragment(char **areaToRead, long lengthToDecode,
00082 long uncompressedSegmentSize,FILE *fp);
00083
00084 bool gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer);
00085
00086 bool gdcm_read_JPEG2000_file (FILE *fp,void * image_buffer);
00087
00088
00089 bool gdcm_read_RLE_file (FILE *fp,void * image_buffer);
00090
00091
00092 gdcmHeader *Header;
00093 bool SelfHeader;
00094
00095 void* PixelData;
00096 size_t lgrTotaleRaw;
00097 size_t lgrTotale;
00098
00099 int PixelRead;
00100
00101
00102
00103 int Parsed;
00104 std::string OrigFileName;
00105 };
00106
00107
00108 #endif