]> Creatis software - creaBruker.git/blob - lib/src1/bruker2dicom.h
71ff5dbe827e893e9b18268c7f52d532b3fb63ff
[creaBruker.git] / lib / src1 / bruker2dicom.h
1 #ifndef BRUKER2DICOM_H
2 #define BRUKER2DICOM_H
3
4
5 #include "gdcmFile.h"
6 #include "gdcmFileHelper.h"
7 #include "gdcmCommon.h"
8 #include "gdcmDebug.h"
9 #include "gdcmUtil.h"
10 #include "gdcmDirList.h"
11
12 #include "gdcmArgMgr.h"
13 #include "brukerSystem.h"
14 #include "brukerdataset.h"
15 #include "brukerkspaceobject.h"
16 #include "brukerimage.h"
17
18 #include <iostream>
19 #include <sstream>
20
21
22
23 class creaBruker_EXPORT Bruker2Dicom {
24
25 public:
26  /*! \brief Constructor
27 */
28   Bruker2Dicom () /* : verbose(0), mhd(0), dicom(0), day(O)*/ {};
29 /*! \brief Destructor
30 */
31   ~Bruker2Dicom (){};
32
33   void SetInputDirectory (const std::string &i) { InputDirName  = i;  }
34   void SetOutputDirectory(const std::string &o) { OutputDirName = o;  }
35   void SetConvertModeToDicom()                  { dicom = 1; mhd  = 0;}
36   void SetConvertModeToMhd()                    { dicom = 0; mhd  = 1;}  
37   bool Execute();
38   
39   /* 
40   // For debugging pupose only.
41   //Don't need accessors : Attributes are 'public' 
42   
43   void SetVerbose(int v) { verbose = v;}
44   void SetMhd(int m)     { mhd = m;    }
45   void SetDicom(int d)   { dicom = d;  }
46   */     
47
48 private :
49
50 void MakeDicomImage(unsigned char *tabPixels, 
51               int X, 
52               int Y,
53               int nbFrames,
54               int pixelSize,
55               double spacingX, double spacingY, double sliceDistance, 
56               std::string dcmImageName,
57               const std::string &patientName,
58               const char *day,
59               std::string &studyUID,
60               std::string &serieUID,
61               std::string &studyDescr,
62               std::string &serieDescr,
63               std::string &strStudyTimeDate,
64               int imgNum,
65               GDCM_NAME_SPACE::ImageContentType contentType 
66       );
67       
68 std::vector<BrukerImage> CreateImageSet ( );
69
70 void getImhDataType(BrukerFieldData &bDPT, 
71                     std::string &mhdDataPixelType, 
72                     int &pixelSize);
73                     
74 void cleanString(std::string &s);
75
76 bool CreateDirectory(std::string dirNameout);
77
78 void DealWithNiveau1(std::string level1Directory, std::string currentOutputDirName);
79 void DealWithNiveau2(std::string level2Directory, std::string currentOutputDirName);
80 void DealWithNiveau3(std::string level3Directory, std::string currentOutputDirName);
81                     
82 void dealWithCarto(GDCM_NAME_SPACE::DirListType &fileNames, int NX, int NY, int nbSlices, 
83                    double fovX, double fovY, double sliceDistance,
84                    char *copyFile, std::string &currentOutputDirName, 
85                    char *outputMhdFileName, char *output2dseqCartoName);
86
87 public:
88
89 // these ones are for debugging only
90 // don't bbfy the accessors.
91
92    int verbose;
93    const char *day;
94        
95 private :
96    std::string InputDirName;
97    std::string OutputDirName;
98  
99    int mhd;
100    int dicom;
101      
102    int nbSlices;
103    BrukerDataSet br_subject;
104    BrukerDataSet br_acqp;
105    BrukerDataSet br_method;
106    BrukerDataSet br_d3proc;
107    BrukerDataSet br_isa;
108    BrukerDataSet br_reco;
109
110    std::vector<BrukerImage> imageSet;
111
112 // For DICOM images.
113
114    std::string strStudyUID; 
115    std::string strSerieUID; 
116    std::string strStudyDescr; 
117    std::string strSerieDescr;
118    std::string strStudyTimeDate;
119    std::string strPatientName;      
120 };
121
122
123 #endif