Pipelined import of itk::Image. More...
#include <mitkITKImageImport.h>
Public Types | |
typedef TInputImage | InputImageType |
The type of the input image. | |
typedef InputImageType::Pointer | InputImagePointer |
typedef InputImageType::ConstPointer | InputImageConstPointer |
typedef InputImageType::RegionType | InputImageRegionType |
typedef InputImageType::PixelType | InputImagePixelType |
Public Member Functions | |
mitkClassMacro (ITKImageImport, ImageSource) | |
itkStaticConstMacro (InputImageDimension, unsigned int, TInputImage::ImageDimension) | |
itkStaticConstMacro (RegionDimension, unsigned int, mitk::SlicedData::RegionDimension) | |
InputImageType * | GetInput (void) |
Set the input itk::Image of this image importer. | |
void | SetInput (const InputImageType *) |
Set the input itk::Image of this image importer. | |
void | SetGeometry (const Geometry3D *geometry) |
Set the Geometry of the result image (optional) | |
Static Public Member Functions | |
static Pointer | New () |
Method for creation through the object factory. | |
Protected Types | |
typedef itk::ImageToImageFilterDetail::ImageRegionCopier < itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(RegionDimension)> | OutputToInputRegionCopierType |
Protected Member Functions | |
ITKImageImport () | |
virtual | ~ITKImageImport () |
virtual void | GenerateOutputInformation () |
virtual void | GenerateInputRequestedRegion () |
virtual void | GenerateData () |
A version of GenerateData() specific for image processing filters. | |
virtual void | SetNthOutput (unsigned int num, itk::DataObject *output) |
Protected methods for setting outputs. | |
Protected Attributes | |
Geometry3D::Pointer | m_Geometry |
Pipelined import of itk::Image.
The image data contained in the itk::Image is referenced, not copied. The easiest way of use is by the function mitk::ImportItkImage
//## mitkImage = mitk::ImportItkImage(itkImage); //##
Definition at line 41 of file mitkITKImageImport.h.
typedef InputImageType::ConstPointer mitk::ITKImageImport< TInputImage >::InputImageConstPointer |
Definition at line 52 of file mitkITKImageImport.h.
typedef InputImageType::PixelType mitk::ITKImageImport< TInputImage >::InputImagePixelType |
Definition at line 54 of file mitkITKImageImport.h.
typedef InputImageType::Pointer mitk::ITKImageImport< TInputImage >::InputImagePointer |
Definition at line 51 of file mitkITKImageImport.h.
typedef InputImageType::RegionType mitk::ITKImageImport< TInputImage >::InputImageRegionType |
Definition at line 53 of file mitkITKImageImport.h.
typedef TInputImage mitk::ITKImageImport< TInputImage >::InputImageType |
The type of the input image.
Definition at line 46 of file mitkITKImageImport.h.
typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(RegionDimension)> mitk::ITKImageImport< TInputImage >::OutputToInputRegionCopierType [protected] |
Typedef for the region copier function object that converts an output region to an input region.
Definition at line 98 of file mitkITKImageImport.h.
mitk::ITKImageImport< TInputImage >::ITKImageImport | ( | ) | [protected] |
Definition at line 24 of file mitkITKImageImport.txx.
{ }
mitk::ITKImageImport< TInputImage >::~ITKImageImport | ( | ) | [protected, virtual] |
Definition at line 29 of file mitkITKImageImport.txx.
{ }
void mitk::ITKImageImport< TInputImage >::GenerateData | ( | ) | [protected, virtual] |
A version of GenerateData() specific for image processing filters.
This implementation will split the processing across multiple threads. The buffer is allocated by this method. Then the BeforeThreadedGenerateData() method is called (if provided). Then, a series of threads are spawned each calling ThreadedGenerateData(). After all the threads have completed processing, the AfterThreadedGenerateData() method is called (if provided). If an image processing filter cannot be threaded, the filter should provide an implementation of GenerateData(). That implementation is responsible for allocating the output buffer. If a filter an be threaded, it should NOT provide a GenerateData() method but should provide a ThreadedGenerateData() instead.
Reimplemented from mitk::ImageSource.
Definition at line 78 of file mitkITKImageImport.txx.
References mitk::Image::ReferenceMemory.
{ InputImageConstPointer input = this->GetInput(); mitk::Image::Pointer output = this->GetOutput(); output->SetImportChannel((void*)input->GetBufferPointer(), 0, mitk::Image::ReferenceMemory); }
void mitk::ITKImageImport< TInputImage >::GenerateInputRequestedRegion | ( | ) | [protected, virtual] |
Definition at line 87 of file mitkITKImageImport.txx.
{ Superclass::GenerateInputRequestedRegion(); // Input is an image, cast away the constness so we can set // the requested region. InputImagePointer input = const_cast< TInputImage * > ( this->GetInput() ); // Use the function object RegionCopier to copy the output region // to the input. The default region copier has default implementations // to handle the cases where the input and output are the same // dimension, the input a higher dimension than the output, and the // input a lower dimension than the output. InputImageRegionType inputRegion; OutputToInputRegionCopierType regionCopier; regionCopier(inputRegion, this->GetOutput()->GetRequestedRegion()); input->SetRequestedRegion( inputRegion ); }
void mitk::ITKImageImport< TInputImage >::GenerateOutputInformation | ( | ) | [protected, virtual] |
Definition at line 62 of file mitkITKImageImport.txx.
{ InputImageConstPointer input = this->GetInput(); mitk::Image::Pointer output = this->GetOutput(); itkDebugMacro(<<"GenerateOutputInformation()"); output->InitializeByItk(input.GetPointer()); if(m_Geometry.IsNotNull()) { output->SetGeometry(m_Geometry); } }
mitk::ITKImageImport< TInputImage >::InputImageType * mitk::ITKImageImport< TInputImage >::GetInput | ( | void | ) |
Set the input itk::Image of this image importer.
Definition at line 35 of file mitkITKImageImport.txx.
{ return static_cast<TInputImage*>( this->ProcessObject::GetInput(0)); }
mitk::ITKImageImport< TInputImage >::itkStaticConstMacro | ( | InputImageDimension | , |
unsigned | int, | ||
TInputImage::ImageDimension | |||
) |
ImageDimension constants
mitk::ITKImageImport< TInputImage >::itkStaticConstMacro | ( | RegionDimension | , |
unsigned | int, | ||
mitk::SlicedData::RegionDimension | |||
) |
mitk::ITKImageImport< TInputImage >::mitkClassMacro | ( | ITKImageImport< TInputImage > | , |
ImageSource | |||
) |
static Pointer mitk::ITKImageImport< TInputImage >::New | ( | ) | [static] |
Method for creation through the object factory.
Reimplemented from mitk::ImageSource.
Referenced by mitk::ImportItkImage().
void mitk::ITKImageImport< TInputImage >::SetGeometry | ( | const Geometry3D * | geometry ) |
Set the Geometry of the result image (optional)
The Geometry has to fit the dimension and size of the input image. The Geometry will be cloned, not referenced!
Providing the Geometry is optional. The default behavior is to set the geometry by the itk::Image::GetDirection() information.
Definition at line 48 of file mitkITKImageImport.txx.
References mitk::Geometry3D::Clone().
Referenced by mitk::ImportItkImage().
{ if(geometry != NULL) { m_Geometry = static_cast<mitk::Geometry3D*>(geometry->Clone().GetPointer()); } else { m_Geometry = NULL; } Modified(); }
void mitk::ITKImageImport< TInputImage >::SetInput | ( | const InputImageType * | input ) |
Set the input itk::Image of this image importer.
Definition at line 42 of file mitkITKImageImport.txx.
Referenced by mitk::ImportItkImage().
{ this->ProcessObject::SetNthInput(0, const_cast<TInputImage*>(input) ); }
void mitk::ITKImageImport< TInputImage >::SetNthOutput | ( | unsigned int | idx, |
itk::DataObject * | output | ||
) | [protected, virtual] |
Protected methods for setting outputs.
Subclasses make use of them for getting output. These are only overwritten because of itk::DataObject::ConnectSource being private and non-virtual: the important stuff is done in mitk::BaseData::ConnectSource.
Set an output of this filter. This method specifically does not do a Register()/UnRegister() because of the desire to break the reference counting loop.
Reimplemented from mitk::BaseProcess.
Definition at line 108 of file mitkITKImageImport.txx.
{ if((output == NULL) && (idx == 0)) { // we are disconnected from our output: // copy buffer of input to output, because we // cannot guarantee that the input (to which our // output is refering) will stay alive. InputImageConstPointer input = this->GetInput(); mitk::Image::Pointer currentOutput = this->GetOutput(); if(input.IsNotNull() && currentOutput.IsNotNull()) currentOutput->SetChannel(input->GetBufferPointer()); } Superclass::SetNthOutput(idx, output); }
Geometry3D::Pointer mitk::ITKImageImport< TInputImage >::m_Geometry [protected] |
Definition at line 100 of file mitkITKImageImport.h.