#pragma once /*========================================================================= medInria Copyright (c) INRIA 2013 - 2020. All rights reserved. See LICENSE.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #include #include #include #include #include #include #include class medAbstractData; // /////////////////////////////////////////////////////////////////////////// // Interface for vtkItkConversion different class /** * @class vtkItkConversionInterface "Interface class for itk to vtk converter" ServiceDescr.h * @brief Interface for itk to vtk converter. It is the base of template class vtkItkConversion. * @detail the static function createInstance is here to provide an object to match with this interface. */ class MEDIMAGEIO_EXPORT vtkItkConversionInterface { public: virtual ~vtkItkConversionInterface() {} virtual bool SetITKInput(itk::DataObject::Pointer pi_input) = 0; virtual bool GetConversion(vtkAlgorithmOutput *& po_poAlgoOut, vtkMatrix4x4 *&po_poMatrix) = 0; virtual bool setTimeIndex(unsigned int pi_uiTimeIndex) = 0; virtual unsigned int getTimeIndex() = 0; virtual unsigned int getNumberOfVolumes() = 0; virtual float getTotalTime() = 0; virtual double * getCurrentScalarRange() = 0; static vtkItkConversionInterface * createInstance(medAbstractData* pi_poData); protected: vtkItkConversionInterface() {} }; // /////////////////////////////////////////////////////////////////////////// // Template for concrete implementation of vtkItkConversionInterface /** * @class vtkItkConversion "Template class for itk to vtk converter" ServiceDescr.h * @brief Template for itk to vtk converter. It inherits vtkItkConversionInterface. * @detail It keep inside the ITK input image and provide for output an vtk port.
The hearth of this class is a itk::ImageToVTKImageFilter */ template class vtkItkConversion final : public vtkItkConversionInterface { typedef typename itk::Image Image4DType; typedef typename itk::Image Image3DType; typedef itk::ImageToVTKImageFilter< itk::Image > ConverterType; private: // /////////////////////////////////////////////////////////////////////// // 3D typename ConverterType::Pointer m_ImageConverter; /*!VTK converter inside, to prevent the image buffer to be deleted unexpectedly. */ typename itk::Image::Pointer m_ItkInputImage; /*!::Pointer m_ItkInputImage4D; /*!::Pointer> m_oVolumeVectorFrom4D; /*!::Pointer &input); bool volumeExtraction(); void conversion(); }; #include