X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRT_ROI_ConvertToImageFilter.h;h=cb06933a59ad9506a68ba55f05d15e8b6d9ca59b;hb=3fc5b4681b8e77aaedb0ce85176686b7d8e6c68c;hp=d5d27b31bbcd03bdf31f84f1d0ce9ba33307b18f;hpb=163fa80ef3873595f3e3cf75fb03e53536d1a6ee;p=clitk.git diff --git a/common/clitkDicomRT_ROI_ConvertToImageFilter.h b/common/clitkDicomRT_ROI_ConvertToImageFilter.h index d5d27b3..cb06933 100644 --- a/common/clitkDicomRT_ROI_ConvertToImageFilter.h +++ b/common/clitkDicomRT_ROI_ConvertToImageFilter.h @@ -4,7 +4,7 @@ Authors belongs to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -23,6 +23,8 @@ #include "clitkDicomRT_ROI.h" #include "clitkImageCommon.h" #include +#include +#include namespace clitk { @@ -34,25 +36,46 @@ namespace clitk { ~DicomRT_ROI_ConvertToImageFilter(); void SetROI(clitk::DicomRT_ROI * roi); + ///This is used to create a mask with the same characteristics as an input image void SetImageFilename(std::string s); + void SetOutputOrigin(const double* origin); + void SetOutputSpacing(const double* spacing); + void SetOutputSize(const unsigned long* size); void SetOutputImageFilename(std::string s); void Update(); vtkImageData * GetOutput(); + template typename itk::Image::ConstPointer GetITKOutput(); void SetCropMaskEnabled(bool b); protected: - bool mImageInfoIsSet; + bool ImageInfoIsSet() const; bool mWriteOutput; bool mCropMask; std::string mOutputFilename; std::vector mSpacing; std::vector mOrigin; - std::vector mSize; + std::vector mSize; clitk::DicomRT_ROI * mROI; - vtkImageData * mBinaryImage; + vtkSmartPointer mBinaryImage; }; //-------------------------------------------------------------------- } // end namespace clitk + + +//-------------------------------------------------------------------- + +template +typename itk::Image::ConstPointer clitk::DicomRT_ROI_ConvertToImageFilter::GetITKOutput() +{ + assert(mBinaryImage); + typedef itk::Image ConnectorImageType; + typedef itk::VTKImageToImageFilter ConnectorType; + typename ConnectorType::Pointer connector = ConnectorType::New(); + connector->SetInput(mBinaryImage); + connector->Update(); + return connector->GetOutput(); +} +//-------------------------------------------------------------------- #endif // CLITKDICOMRT_ROI_CONVERTTOIMAGEFILTER_H