2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
27 #ifndef BRUKER2DICOM2_H
28 #define BRUKER2DICOM2_H
30 #include <gdcmReader.h>
31 #include "gdcmDirectory.h"
32 #include <vtkGDCMImageReader.h>
33 #include <gdcmScanner.h>
35 #include "gdcmByteSwap.h"
36 #include "gdcmSwapCode.h"
37 #include "gdcmFilename.h"
38 #include "gdcmDataSet.h"
40 #include "gdcmImageWriter.h"
41 #include "gdcmImage.h"
42 #include "gdcmWriter.h"
43 #include "gdcmReader.h"
44 #include "gdcmUIDGenerator.h"
46 //#include "gdcmFile.h"
47 //#include "gdcmFileHelper.h"
48 //#include "gdcmCommon.h"
49 //#include "gdcmDebug.h"
50 //#include "gdcmUtil.h"
51 //#include "gdcmDirList.h"
53 //#include "gdcmArgMgr.h"
54 #include "brukerSystem.h"
55 #include "brukerdataset.h"
56 #include "brukerkspaceobject.h"
57 #include "brukerimage.h"
64 #define VALID_FILE_SEPARATOR "\\"
65 #define INVALID_FILE_SEPARATOR "/"
67 #define INVALID_FILE_SEPARATOR "\\"
68 #define VALID_FILE_SEPARATOR "/"
71 //class __declspec( dllexport ) Bruker2Dicom {
72 class /*creaBruker_EXPORT*/ Bruker2Dicom
76 /*! \brief Constructor
78 Bruker2Dicom () /* : verbose(0), mhd(0), dicom(0), day(O)*/ {};
83 void SetInputDirectory (const std::string &i) { InputDirName = i;}
84 void SetOutputDirectory(const std::string &o) { OutputDirName = o;}
85 void SetConvertModeToDicom() { dicom = 1; mhd = 0;}
86 void SetConvertModeToMhd() { dicom = 0; mhd = 1;}
90 // For debugging pupose only.
91 //Don't need accessors : Attributes are 'public'
93 void SetVerbose(int v) { verbose = v;}
94 void SetMhd(int m) { mhd = m; }
95 void SetDicom(int d) { dicom = d; }
100 void MakeDicomImage(unsigned char *tabPixels,
105 double spacingX, double spacingY, double sliceDistance,
106 std::string dcmImageName,
107 const std::string &patientName,
109 std::string &studyUID,
110 std::string &serieUID,
111 std::string &studyDescr,
112 std::string &serieDescr,
113 std::string &strStudyTimeDate,
114 int imgNum, int imagecontenttype//gdcm2 dont have such things, I think, as ImageContentTYpe
117 std::vector<BrukerImage> CreateImageSet ( );
119 void getImhDataType(BrukerFieldData &bDPT,
120 std::string &mhdDataPixelType,
123 void cleanString(std::string &s);
125 bool CreateDirectory(const std::string &dirNameout);
127 int CheckUserDirectory(std::string &userDirName);
128 void DealWithMultiStudyDirectory(gdcm::Directory::FilenamesType &fileNames, const std::string ¤tOutputDirName);
129 void DealWithSingleStudyDirectory (const std::string dirname, const std::string currentOutputDirName) ;
131 void DealWithNiveau1(std::string level1Directory, std::string currentOutputDirName);
132 void DealWithNiveau2(std::string level2Directory, std::string currentOutputDirName);
133 void DealWithNiveau3(std::string &level3Directory, std::string ¤tOutputDirName);
135 void dealWithCarto(gdcm::Directory::FilenamesType &fileNames, int NX, int NY, int nbSlices,
136 double fovX, double fovY, double sliceDistance,
137 char *copyFile, std::string ¤tOutputDirName,
138 char *outputMhdFileName, char *output2dseqCartoName);
140 const std::string createDirectory(const std::string &i_name,const std::string &i_dir);
141 std::string findFile(const std::string &i_dir, const std::string i_name);
144 // these ones are for debugging only
145 // don't bbfy the accessors.
151 std::string InputDirName;
152 std::string OutputDirName;
157 std::string subject_entry;
158 std::string subject_position;
159 std::string subject_date;
160 std::string subject_study_name;
166 BrukerDataSet br_subject;
167 BrukerDataSet br_acqp;
168 BrukerDataSet br_method;
169 BrukerDataSet br_d3proc;
170 BrukerDataSet br_isa;
171 BrukerDataSet br_reco;
173 std::vector<BrukerImage> imageSet;
177 std::string strStudyUID;
178 std::string strSerieUID;
179 std::string strStudyDescr;
180 std::string strSerieDescr;
181 std::string strStudyTimeDate;
182 std::string strPatientName;
183 std::string subject_name; // cleaned strPatientName