Provides access to a channel of the input image. More...
#include <mitkImageChannelSelector.h>
Public Member Functions | |
mitkClassMacro (ImageChannelSelector, SubImageSelector) | |
virtual int | GetChannelNr () const |
virtual void | SetChannelNr (int _arg) |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
ImageChannelSelector () | |
virtual | ~ImageChannelSelector () |
virtual void | GenerateOutputInformation () |
virtual void | GenerateInputRequestedRegion () |
virtual void | GenerateData () |
A version of GenerateData() specific for image processing filters. | |
Protected Attributes | |
int | m_ChannelNr |
Provides access to a channel of the input image.
If the input is generated by a ProcessObject, only the required data is requested.
Definition at line 33 of file mitkImageChannelSelector.h.
mitk::ImageChannelSelector::ImageChannelSelector | ( | ) | [protected] |
Definition at line 23 of file mitkImageChannelSelector.cpp.
: m_ChannelNr(0) { }
mitk::ImageChannelSelector::~ImageChannelSelector | ( | ) | [protected, virtual] |
Definition at line 27 of file mitkImageChannelSelector.cpp.
{ }
void mitk::ImageChannelSelector::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 45 of file mitkImageChannelSelector.cpp.
{ const Image::RegionType& requestedRegion = GetOutput()->GetRequestedRegion(); //do we really need the complete channel? if(requestedRegion.GetSize(3)>1) SetChannelItem(GetChannelData(m_ChannelNr), 0); else //or only a complete volume at a time? if(requestedRegion.GetSize(2)>1) SetVolumeItem(GetVolumeData(requestedRegion.GetIndex(3), m_ChannelNr), requestedRegion.GetIndex(3), 0); else //not even a complete volume, so now take just a slice! SetSliceItem(GetSliceData(requestedRegion.GetIndex(2), requestedRegion.GetIndex(3), m_ChannelNr), requestedRegion.GetIndex(2), requestedRegion.GetIndex(3), 0); }
void mitk::ImageChannelSelector::GenerateInputRequestedRegion | ( | ) | [protected, virtual] |
What is the input requested region that is required to produce the output requested region? The base assumption for image processing filters is that the input requested region can be set to match the output requested region. If a filter requires more input (for instance a filter that uses neighborhoods needs more input than output to avoid introducing artificial boundary conditions) or less input (for instance a magnify filter) will have to override this method. In doing so, it should call its superclass' implementation as its first step. Note that this imaging filters operate differently than the classes to this point in the class hierachy. Up till now, the base assumption has been that the largest possible region will be requested of the input.
Reimplemented from mitk::ImageToImageFilter.
Definition at line 61 of file mitkImageChannelSelector.cpp.
{ Superclass::GenerateInputRequestedRegion(); mitk::ImageToImageFilter::InputImagePointer input = const_cast< mitk::ImageToImageFilter::InputImageType * > ( this->GetInput() ); mitk::Image::Pointer output = this->GetOutput(); Image::RegionType requestedRegion; requestedRegion = output->GetRequestedRegion(); requestedRegion.SetIndex(4, m_ChannelNr); requestedRegion.SetSize(4, 1); input->SetRequestedRegion( & requestedRegion ); }
void mitk::ImageChannelSelector::GenerateOutputInformation | ( | ) | [protected, virtual] |
Definition at line 31 of file mitkImageChannelSelector.cpp.
{ mitk::Image::ConstPointer input = this->GetInput(); mitk::Image::Pointer output = this->GetOutput(); itkDebugMacro(<<"GenerateOutputInformation()"); output->Initialize(input->GetPixelType(), input->GetDimension(), input->GetDimensions()); // initialize geometry output->SetPropertyList(input->GetPropertyList()->Clone()); output->SetGeometry(dynamic_cast<Geometry3D*>(input->GetTimeSlicedGeometry()->Clone().GetPointer())); }
virtual int mitk::ImageChannelSelector::GetChannelNr | ( | ) | const [virtual] |
mitk::ImageChannelSelector::mitkClassMacro | ( | ImageChannelSelector | , |
SubImageSelector | |||
) |
static Pointer mitk::ImageChannelSelector::New | ( | ) | [static] |
Method for creation through the object factory.
Reimplemented from mitk::SubImageSelector.
virtual void mitk::ImageChannelSelector::SetChannelNr | ( | int | _arg ) | [virtual] |
int mitk::ImageChannelSelector::m_ChannelNr [protected] |
Definition at line 54 of file mitkImageChannelSelector.h.