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
13 ////// QUESTION: this looks still like an open question whether the
14 ////// relationship between a gdcmFile and gdcmHeader is of
15 ////// type IS_A or HAS_A !
17 class GDCM_EXPORT gdcmFile: public gdcmHeader
21 // Data pointe sur quoi?
22 // sur les Pixels lus?
23 // --> j'ajoute un champ public : Pixels
24 // (il faudra que l'utilisateur puisse modifier les pixels ?)
27 int Parsed; // weather allready parsed
28 string OrigFileName; // To avoid file overwrite
30 int WriteBase(string FileName, FileType type);
32 // je ne suis pas sur d'avoir compris *où* il serait légitime de ranger ca.
33 // on pourra tjs le deplacer, et mettre des accesseurs
37 // Constructor dedicated to writing a new DICOMV3 part10 compliant
38 // file (see SetFileName, SetDcmTag and Write)
39 // TODO Swig gdcmFile();
40 // Opens (in read only and when possible) an existing file and checks
41 // for DICOM compliance. Returns NULL on failure.
42 // Note: the in-memory representation of all available tags found in
43 // the DICOM header is post-poned to first header information access.
44 // This avoid a double parsing of public part of the header when
45 // one sets an a posteriori shadow dictionary (efficiency can be
46 // seen as a side effect).
48 gdcmFile(string & filename);
49 gdcmFile(const char * filename);
51 // For promotion (performs a deepcopy of pointed header object)
52 // TODO Swig gdcmFile(gdcmHeader* header);
53 // TODO Swig ~gdcmFile();
55 // On writing purposes. When instance was created through
56 // gdcmFile(string filename) then the filename argument MUST be different
57 // from the constructor's one (no overwriting allowed).
58 // TODO Swig int SetFileName(string filename);
60 // Allocates necessary memory, copies the data (image[s]/volume[s]) to
61 // newly allocated zone and return a pointer to it:
63 void * GetImageData();
65 // Returns size (in bytes) of required memory to contain data
66 // represented in this file.
68 size_t GetImageDataSize();
70 // Copies (at most MaxSize bytes) of data to caller's memory space.
71 // Returns an error code on failure (if MaxSize is not big enough)
73 int GetImageDataIntoVector(void* destination, size_t MaxSize );
75 // Allocates ExpectedSize bytes of memory at this->Data and copies the
76 // pointed data to it.
79 // Pourquoi dupliquer les pixels, alors qu'on les a deja en mémoire,
80 // et que Data (dans le gdcmHeader) est un pointeur ?
82 int SetImageData (void * Data, size_t ExpectedSize);
83 void SetImageDataSize (size_t ExpectedSize);
86 // A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
87 // incohérente avec l'ordre des octets en mémoire
88 // TODO Swig int Write();
90 // Ecrit sur disque les pixels d'UNE image
91 // Aucun test n'est fait sur l'"Endiannerie" du processeur.
92 // Ca sera à l'utilisateur d'appeler son Reader correctement
94 int WriteRawData (string nomFichier);
95 int WriteDcmImplVR(string nomFichier);
96 int WriteDcmImplVR(const char * nomFichier);
97 int WriteDcmExplVR(string nomFichier);
98 int WriteAcr (string nomFichier);