1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef clitkUpdateVRTagDicomGenericFilter_h
19 #define clitkUpdateVRTagDicomGenericFilter_h
21 /* =================================================
22 * @file clitkUpdateVRTagDicomGenericFilter.h
28 ===================================================*/
33 #include "clitkImageCommon.h"
34 #include "clitkUpdateVRTagDicom_ggo.h"
37 #include "itkLightObject.h"
38 #include "itkGDCMImageIO.h"
39 #include "itkMetaDataDictionary.h"
40 #include "itkGDCMSeriesFileNames.h"
41 #include "itkImageSeriesReader.h"
42 #include "itkImageSeriesWriter.h"
43 #include "itkImageFileReader.h"
44 #include "itkImageFileWriter.h"
46 #include <itksys/SystemTools.hxx>
76 template<class args_info_type>
77 class ITK_EXPORT UpdateVRTagDicomGenericFilter : public itk::LightObject
80 //----------------------------------------
82 //----------------------------------------
83 typedef UpdateVRTagDicomGenericFilter Self;
84 typedef itk::LightObject Superclass;
85 typedef itk::SmartPointer<Self> Pointer;
86 typedef itk::SmartPointer<const Self> ConstPointer;
88 // Method for creation through the object factory
91 // Run-time type information (and related methods)
92 itkTypeMacro( UpdateVRTagDicomGenericFilter, LightObject );
95 //----------------------------------------
97 //----------------------------------------
100 //----------------------------------------
102 //----------------------------------------
103 void SetArgsInfo(const args_info_type & a)
106 m_Verbose=m_ArgsInfo.verbose_flag;
107 m_InputFileName=m_ArgsInfo.input_arg;
111 //----------------------------------------
113 //----------------------------------------
118 //----------------------------------------
119 // Constructor & Destructor
120 //----------------------------------------
121 UpdateVRTagDicomGenericFilter();
122 ~UpdateVRTagDicomGenericFilter() {};
125 //----------------------------------------
127 //----------------------------------------
128 template <unsigned int Dimension> void UpdateWithDim(std::string PixelType);
129 template <unsigned int Dimension, class PixelType> void UpdateWithDimAndPixelType();
130 template <unsigned int Dimension, class PixelType> void ReadDataElement(std::ifstream& f, std::ifstream& model);
131 template <unsigned int Dimension, class PixelType> void ReadDicomObject(std::ifstream& f, std::ifstream& model);
132 template <unsigned int Dimension, class PixelType> void InitVRMap();
133 template <unsigned int Dimension, class PixelType> void UpdateVRMap();
136 //----------------------------------------
138 //----------------------------------------
139 args_info_type m_ArgsInfo;
141 std::string m_InputFileName;
147 uint32_t LengthModel;
150 std::map<std::string, valrep_t> VRMap;
151 std::map<std::string, std::string> VRMapModel;
153 std::ofstream output;
162 //Copy dicom dictionary
163 void CopyDictionary (itk::MetaDataDictionary &fromDict, itk::MetaDataDictionary &toDict);
165 //convert to std::string
166 template <typename T> std::string NumberToString ( T Number );
167 template <typename T> std::string int_to_hex ( T Number );
168 std::string string_to_hex( std::string &input );
170 } // end namespace clitk
172 #ifndef ITK_MANUAL_INSTANTIATION
173 #include "clitkUpdateVRTagDicomGenericFilter.txx"
176 #endif // #define clitkUpdateVRTagDicomGenericFilter_h