6 #include "gdcmCommon.h"
7 #include "gdcmHeader.h"
9 ////////////////////////////////////////////////////////////////////////////
10 // In addition to Dicom header exploration, this class is designed
11 // for accessing the image/volume content. One can also use it to
14 class GDCM_EXPORT gdcmFile
17 gdcmHeader *Header; // Header to use to load the file
21 size_t lgrTotaleRaw; // Area length to receive the pixels
22 size_t lgrTotale; // Area length to receive the RGB pixels
23 // from Grey Plane + Palette Color
25 int Parsed; // weather already parsed
26 std::string OrigFileName; // To avoid file overwrite
27 void SwapZone(void* im, int swap, int lgr, int nb);
29 bool ReadPixelData(void * destination);
31 bool gdcm_read_JPEG_file (FILE *fp,void * image_buffer); // For JPEG 8 Bits
32 bool gdcm_read_JPEG_file12 (FILE *fp,void * image_buffer); // For JPEG 12 Bits
33 bool gdcm_read_JPEG2000_file (FILE *fp,void * image_buffer); // For JPEG 2000 (TODO)
35 // For Run Length Encoding (TOCHECK)
36 bool gdcm_read_RLE_file (FILE *fp,void * image_buffer);
40 int WriteBase(std::string FileName, FileType type);
43 gdcmFile(gdcmHeader *header);
44 gdcmFile(std::string & filename);
45 gdcmFile(const char * filename);
46 virtual ~gdcmFile(void);
48 gdcmHeader *GetHeader(void);
50 // For promotion (performs a deepcopy of pointed header object)
51 // TODO Swig gdcmFile(gdcmHeader* header);
52 // TODO Swig ~gdcmFile();
54 // On writing purposes. When instance was created through
55 // gdcmFile(std::string filename) then the filename argument MUST be
56 // different from the constructor's one (no overwriting allowed).
57 // TODO Swig int SetFileName(std::string filename);
59 void SetPixelDataSizeFromHeader(void);
60 size_t GetImageDataSize();
61 size_t GetImageDataSizeRaw();
62 void * GetImageData();
63 size_t GetImageDataIntoVector(void* destination, size_t MaxSize);
64 void * GetImageDataRaw();
65 size_t GetImageDataIntoVectorRaw(void* destination, size_t MaxSize);
67 // Allocates ExpectedSize bytes of memory at this->Data and copies the
68 // pointed data to it. Copying the image might look useless but
69 // the caller might destroy it's image (without knowing it: think
70 // of a complicated interface where display is done with a library
71 // e.g. VTK) before calling the Write
72 int SetImageData (void * Data, size_t ExpectedSize);
73 // When the caller is aware we simply point to the data:
74 // TODO int SetImageDataNoCopy (void * Data, size_t ExpectedSize);
77 // A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
78 // incohérente avec l'ordre des octets en mémoire ?
79 // TODO Swig int Write();
81 // Ecrit sur disque les pixels d'UNE image
82 // Aucun test n'est fait sur l'"Endiannerie" du processeur.
83 // Ca sera à l'utilisateur d'appeler son Reader correctement
85 int WriteRawData (std::string fileName);
86 int WriteDcmImplVR(std::string fileName);
87 int WriteDcmImplVR(const char * fileName);
88 int WriteDcmExplVR(std::string fileName);
89 int WriteAcr (std::string fileName);
91 bool ParsePixelData(void);