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 BRUKER2DICOM_H
28 #define BRUKER2DICOM_H
32 #include "gdcmFileHelper.h"
33 #include "gdcmCommon.h"
34 #include "gdcmDebug.h"
36 #include "gdcmDirList.h"
38 #include "gdcmArgMgr.h"
39 #include "brukerSystem.h"
40 #include "brukerdataset.h"
41 #include "brukerkspaceobject.h"
42 #include "brukerimage.h"
49 class /*creaBruker_EXPORT*/ Bruker2Dicom {
52 /*! \brief Constructor
54 Bruker2Dicom () /* : verbose(0), mhd(0), dicom(0), day(O)*/ {};
59 void SetInputDirectory (const std::string &i) { InputDirName = i;}
60 void SetOutputDirectory(const std::string &o) { OutputDirName = o;}
61 void SetConvertModeToDicom() { dicom = 1; mhd = 0;}
62 void SetConvertModeToMhd() { dicom = 0; mhd = 1;}
66 // For debugging pupose only.
67 //Don't need accessors : Attributes are 'public'
69 void SetVerbose(int v) { verbose = v;}
70 void SetMhd(int m) { mhd = m; }
71 void SetDicom(int d) { dicom = d; }
76 void MakeDicomImage(unsigned char *tabPixels,
81 double spacingX, double spacingY, double sliceDistance,
82 std::string dcmImageName,
83 const std::string &patientName,
85 std::string &studyUID,
86 std::string &serieUID,
87 std::string &studyDescr,
88 std::string &serieDescr,
89 std::string &strStudyTimeDate,
91 GDCM_NAME_SPACE::ImageContentType contentType
94 std::vector<BrukerImage> CreateImageSet ( int dimension);
96 void getImhDataType(BrukerFieldData &bDPT,
97 std::string &mhdDataPixelType,
100 void cleanString(std::string &s);
102 bool CreateDirectory(std::string &dirNameout);
104 int CheckUserDirectory(std::string &userDirName);
105 void DealWithMultiStudyDirectory(GDCM_NAME_SPACE::DirListType &fileNames,int dimension);
106 void DealWithSingleStudyDirectory(GDCM_NAME_SPACE::DirListType &fileNames, int dimension);
107 void DealWithNiveau1(std::string &level1Directory, std::string ¤tOutputDirName, int dimension);
108 void DealWithNiveau2(std::string &level2Directory, std::string ¤tOutputDirName, int dimension);
109 void DealWithNiveau3(std::string &level3Directory, std::string ¤tOutputDirName, int dimension);
111 void dealWithCarto(GDCM_NAME_SPACE::DirListType &fileNames, int NX, int NY, int nbSlices,
112 double fovX, double fovY, double sliceDistance,
113 char *copyFile, std::string ¤tOutputDirName,
114 char *outputMhdFileName, char *output2dseqCartoName);
117 // these ones are for debugging only
118 // don't bbfy the accessors.
124 std::string InputDirName;
125 std::string OutputDirName;
130 std::string subject_entry;
131 std::string subject_position;
132 std::string subject_date;
133 std::string subject_study_name;
139 BrukerDataSet br_subject;
140 BrukerDataSet br_acqp;
141 BrukerDataSet br_method;
142 BrukerDataSet br_d3proc;
143 BrukerDataSet br_isa;
144 BrukerDataSet br_reco;
146 std::vector<BrukerImage> imageSet;
150 std::string strStudyUID;
151 std::string strSerieUID;
152 std::string strStudyDescr;
153 std::string strSerieDescr;
154 std::string strStudyTimeDate;
155 std::string strPatientName;
156 std::string subject_name; // cleaned strPatientName