6 #include "gdcmCommon.h"
7 #include "gdcmHeader.h"
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);
39 int WriteBase(std::string FileName, FileType type);
42 gdcmFile(gdcmHeader *header);
43 gdcmFile(std::string & filename);
44 gdcmFile(const char * filename);
45 virtual ~gdcmFile(void);
47 gdcmHeader *GetHeader(void);
49 // For promotion (performs a deepcopy of pointed header object)
50 // TODO Swig gdcmFile(gdcmHeader* header);
51 // TODO Swig ~gdcmFile();
53 // On writing purposes. When instance was created through
54 // gdcmFile(std::string filename) then the filename argument MUST be
55 // different from the constructor's one (no overwriting allowed).
56 // TODO Swig int SetFileName(std::string filename);
58 void SetPixelDataSizeFromHeader(void);
59 size_t GetImageDataSize();
60 size_t GetImageDataSizeRaw();
61 void * GetImageData();
62 size_t GetImageDataIntoVector(void* destination, size_t MaxSize);
63 void * GetImageDataRaw();
64 size_t GetImageDataIntoVectorRaw(void* destination, size_t MaxSize);
66 // Allocates ExpectedSize bytes of memory at this->Data and copies the
67 // pointed data to it. Copying the image might look useless but
68 // the caller might destroy it's image (without knowing it: think
69 // of a complicated interface where display is done with a library
70 // e.g. VTK) before calling the Write
71 int SetImageData (void * Data, size_t ExpectedSize);
72 // When the caller is aware we simply point to the data:
73 // TODO int SetImageDataNoCopy (void * Data, size_t ExpectedSize);
76 // A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
77 // incohérente avec l'ordre des octets en mémoire ?
78 // TODO Swig int Write();
80 // Ecrit sur disque les pixels d'UNE image
81 // Aucun test n'est fait sur l'"Endiannerie" du processeur.
82 // Ca sera à l'utilisateur d'appeler son Reader correctement
83 int WriteRawData (std::string fileName);
84 int WriteDcmImplVR(std::string fileName);
85 int WriteDcmImplVR(const char * fileName);
86 int WriteDcmExplVR(std::string fileName);
87 int WriteAcr (std::string fileName);
89 bool ParsePixelData(void);