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);
48 vtkImageData * GetOutput();
49 template <int Dimension> typename itk::Image<unsigned char,Dimension>::ConstPointer GetITKOutput();
50 void SetCropMaskEnabled(bool b);
51 void SetWriteOutputFlag(bool b);
54 bool ImageInfoIsSet() const;
57 std::string mOutputFilename;
58 std::vector<double> mSpacing;
59 std::vector<double> mOrigin;
60 std::vector<unsigned long> mSize;
61 std::vector< std::vector< double> > mDirection;
62 vtkSmartPointer<vtkMatrix4x4> mTransformMatrix;
63 clitk::DicomRT_ROI * mROI;
64 vtkSmartPointer<vtkImageData> mBinaryImage;
66 //--------------------------------------------------------------------
68 } // end namespace clitk
71 //--------------------------------------------------------------------
73 template <int Dimension>
74 typename itk::Image<unsigned char,Dimension>::ConstPointer clitk::DicomRTStruct2ImageFilter::GetITKOutput()
77 typedef itk::Image<unsigned char,Dimension> ConnectorImageType;
78 typedef itk::VTKImageToImageFilter <ConnectorImageType> ConnectorType;
79 typename ConnectorType::Pointer connector = ConnectorType::New();
80 connector->SetInput(mBinaryImage);
82 return connector->GetOutput();
84 //--------------------------------------------------------------------
85 #endif // CLITKDICOMRT_TRUCT2IMAGEFILTER_H