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: public gdcmHeader
19 int Parsed; // weather allready parsed
20 string OrigFileName; // To avoid file overwrite
21 void SwapZone(void* im, int swap, int lgr, int nb);
22 bool ReadPixelData(void * destination);
24 int WriteBase(string FileName, FileType type);
26 gdcmFile(string & filename);
27 gdcmFile(const char * filename);
29 // For promotion (performs a deepcopy of pointed header object)
30 // TODO Swig gdcmFile(gdcmHeader* header);
31 // TODO Swig ~gdcmFile();
33 // On writing purposes. When instance was created through
34 // gdcmFile(string filename) then the filename argument MUST be different
35 // from the constructor's one (no overwriting allowed).
36 // TODO Swig int SetFileName(string filename);
38 void SetPixelDataSizeFromHeader(void);
39 // Returns size (in bytes) of required memory to contain data
40 // represented in this file.
41 size_t GetImageDataSize();
43 // Allocates necessary memory, copies the data (image[s]/volume[s]) to
44 // newly allocated zone and return a pointer to it:
45 void * GetImageData();
47 // Copies (at most MaxSize bytes) of data to caller's memory space.
48 // Returns an error code on failure (if MaxSize is not big enough)
49 size_t GetImageDataIntoVector(void* destination, size_t MaxSize );
51 // Allocates ExpectedSize bytes of memory at this->Data and copies the
52 // pointed data to it. Copying the image might look useless but
53 // the caller might destroy it's image (without knowing it: think
54 // of a complicated interface where display is done with a library
55 // e.g. VTK) before calling the Write
56 int SetImageData (void * Data, size_t ExpectedSize);
57 // When the caller is aware we simply point to the data:
58 // TODO int SetImageDataNoCopy (void * Data, size_t ExpectedSize);
59 void SetImageDataSize (size_t ExpectedSize);
62 // A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
63 // incohérente avec l'ordre des octets en mémoire
64 // TODO Swig int Write();
66 // Ecrit sur disque les pixels d'UNE image
67 // Aucun test n'est fait sur l'"Endiannerie" du processeur.
68 // Ca sera à l'utilisateur d'appeler son Reader correctement
70 int WriteRawData (string nomFichier);
71 int WriteDcmImplVR(string nomFichier);
72 int WriteDcmImplVR(const char * nomFichier);
73 int WriteDcmExplVR(string nomFichier);
74 int WriteAcr (string nomFichier);