]> Creatis software - clitk.git/blobdiff - common/clitkDicomRT_ROI_ConvertToImageFilter.h
Remove debug
[clitk.git] / common / clitkDicomRT_ROI_ConvertToImageFilter.h
index d5d27b31bbcd03bdf31f84f1d0ce9ba33307b18f..cb06933a59ad9506a68ba55f05d15e8b6d9ca59b 100644 (file)
@@ -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 <vtkImageData.h>
+#include <itkImage.h>
+#include <itkVTKImageToImageFilter.h>
 
 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 <int Dimension> typename itk::Image<unsigned char,Dimension>::ConstPointer GetITKOutput();
     void SetCropMaskEnabled(bool b);
 
   protected:
-    bool mImageInfoIsSet;
+    bool ImageInfoIsSet() const;
     bool mWriteOutput;
     bool mCropMask;
     std::string mOutputFilename;
     std::vector<double> mSpacing;
     std::vector<double> mOrigin;
-    std::vector<int> mSize;
+    std::vector<unsigned long> mSize;
     clitk::DicomRT_ROI * mROI;
-    vtkImageData * mBinaryImage;
+    vtkSmartPointer<vtkImageData> mBinaryImage;
   };
   //--------------------------------------------------------------------
 
 } // end namespace clitk
+
+
+//--------------------------------------------------------------------
+
+template <int Dimension> 
+typename itk::Image<unsigned char,Dimension>::ConstPointer clitk::DicomRT_ROI_ConvertToImageFilter::GetITKOutput()
+{
+  assert(mBinaryImage);
+  typedef itk::Image<unsigned char,Dimension> ConnectorImageType;
+  typedef itk::VTKImageToImageFilter <ConnectorImageType> ConnectorType;
+  typename ConnectorType::Pointer connector = ConnectorType::New();
+  connector->SetInput(mBinaryImage);
+  connector->Update();
+  return connector->GetOutput();
+}
+//--------------------------------------------------------------------
 #endif // CLITKDICOMRT_ROI_CONVERTTOIMAGEFILTER_H