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 {
75 /*! \brief Constructor
77 Bruker2Dicom () /* : verbose(0), mhd(0), dicom(0), day(O)*/ {};
82 void SetInputDirectory (const std::string &i) { InputDirName = i;}
83 void SetOutputDirectory(const std::string &o) { OutputDirName = o;}
84 void SetConvertModeToDicom() { dicom = 1; mhd = 0;}
85 void SetConvertModeToMhd() { dicom = 0; mhd = 1;}
89 // For debugging pupose only.
90 //Don't need accessors : Attributes are 'public'
92 void SetVerbose(int v) { verbose = v;}
93 void SetMhd(int m) { mhd = m; }
94 void SetDicom(int d) { dicom = d; }
99 void MakeDicomImage(unsigned char *tabPixels,
104 double spacingX, double spacingY, double sliceDistance,
105 std::string dcmImageName,
106 const std::string &patientName,
108 std::string &studyUID,
109 std::string &serieUID,
110 std::string &studyDescr,
111 std::string &serieDescr,
112 std::string &strStudyTimeDate,
113 int imgNum, int imagecontenttype//gdcm2 dont have such things, I think, as ImageContentTYpe
116 std::vector<BrukerImage> CreateImageSet ( );
118 void getImhDataType(BrukerFieldData &bDPT,
119 std::string &mhdDataPixelType,
122 void cleanString(std::string &s);
124 bool CreateDirectory(const std::string &dirNameout);
126 int CheckUserDirectory(std::string &userDirName);
127 void DealWithMultiStudyDirectory(gdcm::Directory::FilenamesType &fileNames, const std::string ¤tOutputDirName);
128 void DealWithSingleStudyDirectory (const std::string dirname, const std::string currentOutputDirName) ;
130 void DealWithNiveau1(std::string level1Directory, std::string currentOutputDirName);
131 void DealWithNiveau2(std::string level2Directory, std::string currentOutputDirName);
132 void DealWithNiveau3(std::string &level3Directory, std::string ¤tOutputDirName);
134 void dealWithCarto(gdcm::Directory::FilenamesType &fileNames, int NX, int NY, int nbSlices,
135 double fovX, double fovY, double sliceDistance,
136 char *copyFile, std::string ¤tOutputDirName,
137 char *outputMhdFileName, char *output2dseqCartoName);
139 const std::string createDirectory(const std::string &i_name,const std::string &i_dir);
140 std::string findFile(const std::string &i_dir, const std::string i_name);
143 // these ones are for debugging only
144 // don't bbfy the accessors.
150 std::string InputDirName;
151 std::string OutputDirName;
156 std::string subject_entry;
157 std::string subject_position;
158 std::string subject_date;
159 std::string subject_study_name;
165 BrukerDataSet br_subject;
166 BrukerDataSet br_acqp;
167 BrukerDataSet br_method;
168 BrukerDataSet br_d3proc;
169 BrukerDataSet br_isa;
170 BrukerDataSet br_reco;
172 std::vector<BrukerImage> imageSet;
176 std::string strStudyUID;
177 std::string strSerieUID;
178 std::string strStudyDescr;
179 std::string strSerieDescr;
180 std::string strStudyTimeDate;
181 std::string strPatientName;
182 std::string subject_name; // cleaned strPatientName