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 // je ne suis pas sur d'avoir compris *où* il serait légitime de ranger ca.
31 // on pourra tjs le deplacer, et mettre des accesseurs
35 // Constructor dedicated to writing a new DICOMV3 part10 compliant
36 // file (see SetFileName, SetDcmTag and Write)
37 // TODO Swig gdcmFile();
38 // Opens (in read only and when possible) an existing file and checks
39 // for DICOM compliance. Returns NULL on failure.
40 // Note: the in-memory representation of all available tags found in
41 // the DICOM header is post-poned to first header information access.
42 // This avoid a double parsing of public part of the header when
43 // one sets an a posteriori shadow dictionary (efficiency can be
44 // seen as a side effect).
46 gdcmFile(string & filename);
48 // For promotion (performs a deepcopy of pointed header object)
49 // TODO Swig gdcmFile(gdcmHeader* header);
50 // TODO Swig ~gdcmFile();
52 // On writing purposes. When instance was created through
53 // gdcmFile(string filename) then the filename argument MUST be different
54 // from the constructor's one (no overwriting allowed).
55 // TODO Swig int SetFileName(string filename);
57 // Allocates necessary memory, copies the data (image[s]/volume[s]) to
58 // newly allocated zone and return a pointer to it:
60 void * GetImageData();
62 // Returns size (in bytes) of required memory to contain data
63 // represented in this file.
65 size_t GetImageDataSize();
67 // Copies (at most MaxSize bytes) of data to caller's memory space.
68 // Returns an error code on failure (if MaxSize is not big enough)
70 int GetImageDataIntoVector(void* destination, size_t MaxSize );
74 // GetImageData et GetImageDataIntoVector
75 // Get et Put pour 2 fonctions qui font presque la meme chose :-(
78 // Allocates ExpectedSize bytes of memory at this->Data and copies the
79 // pointed data to it.
82 // Pourquoi dupliquer les pixels, alors qu'on les a deja en mémoire,
83 // et que Data (dans le gdcmHeader) est un pointeur ?
85 // TODO Swig int SetImageData(void * Data, size_t ExpectedSize);
88 // A NE PAS OUBLIER : que fait-on en cas de Transfert Syntax (dans l'entete)
89 // incohérente avec l'ordre des octets en mémoire
90 // TODO Swig int Write();
92 // Ecrit sur disque les pixels d'UNE image
93 // Aucun test n'est fait sur l'"Endiannerie" du processeur.
94 // Ca sera à l'utilisateur d'appeler son Reader correctement
96 int WriteRawData (string nomFichier);
97 int WriteDcm (string nomFichier);