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 CLITKDICOMRTSTRUCT2IMAGEFILTER_H
23 #include "clitkDicomRT_ROI.h"
24 #include "clitkImageCommon.h"
25 #include <vtkImageData.h>
26 #include <vtkMatrix4x4.h>
28 #include <itkVTKImageToImageFilter.h>
32 //--------------------------------------------------------------------
33 class DicomRTStruct2ImageFilter {
36 DicomRTStruct2ImageFilter();
37 ~DicomRTStruct2ImageFilter();
39 void SetROI(clitk::DicomRT_ROI * roi);
40 ///This is used to create a mask with the same characteristics as an input image
41 void SetImage(vvImage::Pointer image);
42 void SetImageFilename(std::string s);
43 void SetOutputOrigin(const double* origin);
44 void SetOutputSpacing(const double* spacing);
45 void SetOutputSize(const unsigned long* size);
46 void SetOutputImageFilename(std::string s);
47 void SetWriteMesh(bool b);
49 vtkImageData * GetOutput();
50 template <int Dimension> typename itk::Image<unsigned char,Dimension>::ConstPointer GetITKOutput();
51 void SetCropMaskEnabled(bool b);
52 void SetWriteOutputFlag(bool b);
55 bool ImageInfoIsSet() const;
59 std::string mOutputFilename;
60 std::vector<double> mSpacing;
61 std::vector<double> mOrigin;
62 std::vector<unsigned long> mSize;
63 std::vector< std::vector< double> > mDirection;
64 vtkSmartPointer<vtkMatrix4x4> mTransformMatrix;
65 clitk::DicomRT_ROI * mROI;
66 vtkSmartPointer<vtkImageData> mBinaryImage;
68 //--------------------------------------------------------------------
70 } // end namespace clitk
73 //--------------------------------------------------------------------
75 template <int Dimension>
76 typename itk::Image<unsigned char,Dimension>::ConstPointer clitk::DicomRTStruct2ImageFilter::GetITKOutput()
79 typedef itk::Image<unsigned char,Dimension> ConnectorImageType;
80 typedef itk::VTKImageToImageFilter <ConnectorImageType> ConnectorType;
81 typename ConnectorType::Pointer connector = ConnectorType::New();
82 connector->SetInput(mBinaryImage);
84 return connector->GetOutput();
86 //--------------------------------------------------------------------
87 #endif // CLITKDICOMRT_TRUCT2IMAGEFILTER_H