1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
3 Main authors : XX XX XX
6 - University of LYON http://www.universite-lyon.fr/
7 - Léon Bérard cancer center http://www.centreleonberard.fr
8 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the copyright notices for more information.
14 It is distributed under dual licence
15 - BSD http://www.opensource.org/licenses/bsd-license.php
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
18 =========================================================================*/
20 #ifndef CLITKDICOMRTSTRUCT2IMAGEFILTER_H
21 #define CLITKDICOMRT_TRUCT2IMAGEFILTER_H
23 #include "clitkDicomRT_ROI.h"
24 #include "clitkImageCommon.h"
25 #include <vtkImageData.h>
27 #include <itkVTKImageToImageFilter.h>
31 //--------------------------------------------------------------------
32 class DicomRTStruct2ImageFilter {
35 DicomRTStruct2ImageFilter();
36 ~DicomRTStruct2ImageFilter();
38 void SetROI(clitk::DicomRT_ROI * roi);
39 ///This is used to create a mask with the same characteristics as an input image
40 void SetImageFilename(std::string s);
41 void SetOutputOrigin(const double* origin);
42 void SetOutputSpacing(const double* spacing);
43 void SetOutputSize(const unsigned long* size);
44 void SetOutputImageFilename(std::string s);
46 vtkImageData * GetOutput();
47 template <int Dimension> typename itk::Image<unsigned char,Dimension>::ConstPointer GetITKOutput();
48 void SetCropMaskEnabled(bool b);
51 bool ImageInfoIsSet() const;
54 std::string mOutputFilename;
55 std::vector<double> mSpacing;
56 std::vector<double> mOrigin;
57 std::vector<unsigned long> mSize;
58 clitk::DicomRT_ROI * mROI;
59 vtkSmartPointer<vtkImageData> mBinaryImage;
61 //--------------------------------------------------------------------
63 } // end namespace clitk
66 //--------------------------------------------------------------------
68 template <int Dimension>
69 typename itk::Image<unsigned char,Dimension>::ConstPointer clitk::DicomRTStruct2ImageFilter::GetITKOutput()
72 typedef itk::Image<unsigned char,Dimension> ConnectorImageType;
73 typedef itk::VTKImageToImageFilter <ConnectorImageType> ConnectorType;
74 typename ConnectorType::Pointer connector = ConnectorType::New();
75 connector->SetInput(mBinaryImage);
77 return connector->GetOutput();
79 //--------------------------------------------------------------------
80 #endif // CLITKDICOMRT_TRUCT2IMAGEFILTER_H