Super class of data objects consisting of slices. More...
#include <mitkSlicedData.h>
Public Types | |
typedef SlicedData | Self |
typedef BaseData | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
typedef itk::ImageRegion < RegionDimension > | RegionType |
typedef itk::Index < RegionDimension > | IndexType |
typedef IndexType::IndexValueType | IndexValueType |
typedef itk::Offset < RegionDimension > | OffsetType |
typedef OffsetType::OffsetValueType | OffsetValueType |
typedef itk::Size < RegionDimension > | SizeType |
typedef SizeType::SizeValueType | SizeValueType |
Public Member Functions | |
virtual const char * | GetClassName () const |
itkStaticConstMacro (RegionDimension, unsigned int, 5) | |
virtual void | UpdateOutputInformation () |
virtual void | PrepareForNewData () |
virtual void | SetRequestedRegionToLargestPossibleRegion () |
virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
virtual bool | VerifyRequestedRegion () |
Verify that the RequestedRegion is within the LargestPossibleRegion. | |
virtual void | SetRequestedRegion (itk::DataObject *data) |
virtual void | SetRequestedRegion (SlicedData::RegionType *region) |
const RegionType & | GetLargestPossibleRegion () const |
virtual const RegionType & | GetRequestedRegion () const |
virtual bool | IsSliceSet (int s=0, int t=0, int n=0) const =0 |
virtual bool | IsVolumeSet (int t=0, int n=0) const =0 |
virtual bool | IsChannelSet (int n=0) const =0 |
virtual void | CopyInformation (const itk::DataObject *data) |
Copy information from the specified data set. | |
unsigned int | GetNumberOfChannels () const |
Get the number of channels. | |
SlicedGeometry3D * | GetSlicedGeometry (unsigned int t=0) const |
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). | |
const SlicedGeometry3D * | GetUpdatedSlicedGeometry (unsigned int t=0) |
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it). | |
virtual void | SetGeometry (Geometry3D *aGeometry3D) |
Set the Geometry3D of the data, which will be referenced (not copied!). It has to be a sub-class of SlicedGeometry3D. | |
virtual void | SetOrigin (const Point3D &origin) |
Convenience method for setting the origin of the SlicedGeometry3D instances of all time steps. | |
virtual void | SetSpacing (const float aSpacing[3]) |
Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps. | |
virtual void | SetSpacing (mitk::Vector3D aSpacing) |
Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps. | |
Protected Member Functions | |
SlicedData () | |
virtual | ~SlicedData () |
Protected Attributes | |
RegionType | m_LargestPossibleRegion |
RegionType | m_RequestedRegion |
RegionType | m_BufferedRegion |
bool | m_UseLargestPossibleRegion |
Super class of data objects consisting of slices.
Super class of data objects consisting of slices, e.g., images or a stack of contours. (GetGeometry will return a Geometry3D containing Geometry2D objects).
SlicedData-objects have geometries of type SlicedGeometry3D or sub-classes.
Definition at line 44 of file mitkSlicedData.h.
typedef itk::SmartPointer<const Self> mitk::SlicedData::ConstPointer |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Image, mitk::DiffusionImage< TPixelType >, mitk::QBallImage, mitk::TensorImage, mitk::SeedsImage, and mitk::DiffusionImage< DiffusionImagePixelType >.
Definition at line 47 of file mitkSlicedData.h.
typedef itk::Index<RegionDimension> mitk::SlicedData::IndexType |
Index typedef support. An index is used to access pixel values.
Definition at line 55 of file mitkSlicedData.h.
typedef IndexType::IndexValueType mitk::SlicedData::IndexValueType |
Definition at line 56 of file mitkSlicedData.h.
typedef itk::Offset<RegionDimension> mitk::SlicedData::OffsetType |
Offset typedef support. An offset represent relative position between indices.
Definition at line 60 of file mitkSlicedData.h.
typedef OffsetType::OffsetValueType mitk::SlicedData::OffsetValueType |
Definition at line 61 of file mitkSlicedData.h.
typedef itk::SmartPointer<Self> mitk::SlicedData::Pointer |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Image, mitk::DiffusionImage< TPixelType >, mitk::QBallImage, mitk::TensorImage, mitk::SeedsImage, and mitk::DiffusionImage< DiffusionImagePixelType >.
Definition at line 47 of file mitkSlicedData.h.
typedef itk::ImageRegion<RegionDimension> mitk::SlicedData::RegionType |
Region typedef support. A region is used to specify a subset of a SlicedData.
Definition at line 52 of file mitkSlicedData.h.
typedef SlicedData mitk::SlicedData::Self |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Image, mitk::DiffusionImage< TPixelType >, mitk::QBallImage, mitk::TensorImage, mitk::SeedsImage, and mitk::DiffusionImage< DiffusionImagePixelType >.
Definition at line 47 of file mitkSlicedData.h.
typedef itk::Size<RegionDimension> mitk::SlicedData::SizeType |
Size typedef support. A size is used to define region bounds.
Definition at line 64 of file mitkSlicedData.h.
typedef SizeType::SizeValueType mitk::SlicedData::SizeValueType |
Definition at line 65 of file mitkSlicedData.h.
typedef BaseData mitk::SlicedData::Superclass |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Image, mitk::DiffusionImage< TPixelType >, mitk::QBallImage, mitk::TensorImage, mitk::SeedsImage, and mitk::DiffusionImage< DiffusionImagePixelType >.
Definition at line 47 of file mitkSlicedData.h.
mitk::SlicedData::SlicedData | ( | ) | [protected] |
Definition at line 24 of file mitkSlicedData.cpp.
References m_LargestPossibleRegion.
: m_UseLargestPossibleRegion(false) { unsigned int i; for(i=0;i<4;++i) { m_LargestPossibleRegion.SetIndex(i, 0); m_LargestPossibleRegion.SetSize (i, 1); } }
mitk::SlicedData::~SlicedData | ( | ) | [protected, virtual] |
Definition at line 34 of file mitkSlicedData.cpp.
{ }
void mitk::SlicedData::CopyInformation | ( | const itk::DataObject * | data ) | [virtual] |
Copy information from the specified data set.
This method is part of the pipeline execution model. By default, a BaseProcess will copy meta-data from the first input to all of its outputs. See ProcessObject::GenerateOutputInformation(). Each subclass of DataObject is responsible for being able to copy whatever meta-data it needs from another DataObject. The default implementation of this method copies the time sliced geometry and the property list of an object. If a subclass overrides this method, it should always call its superclass' version.
Reimplemented from mitk::BaseData.
Definition at line 199 of file mitkSlicedData.cpp.
References GetLargestPossibleRegion().
Referenced by mitk::ImageSource::GraftNthOutput().
{ // Standard call to the superclass' method Superclass::CopyInformation(data); const mitk::SlicedData *slicedData; slicedData = dynamic_cast<const mitk::SlicedData*>(data); if (slicedData) { m_LargestPossibleRegion = slicedData->GetLargestPossibleRegion(); } else { // pointer could not be cast back down itkExceptionMacro( << "mitk::SlicedData::CopyInformation(const DataObject *data) cannot cast " << typeid(data).name() << " to " << typeid(SlicedData*).name() ); } }
virtual const char* mitk::SlicedData::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Image, mitk::DiffusionImage< TPixelType >, mitk::QBallImage, mitk::TensorImage, mitk::SeedsImage, and mitk::DiffusionImage< DiffusionImagePixelType >.
const RegionType& mitk::SlicedData::GetLargestPossibleRegion | ( | ) | const [inline] |
Definition at line 124 of file mitkSlicedData.h.
Referenced by QmitkDemonsRegistrationView::CalculateTransformation(), CopyInformation(), mitk::ImageMapperGL2D::GenerateData(), mitk::ExtractDirectedPlaneImageFilter::GenerateData(), mitk::ProbeFilter::GenerateInputRequestedRegion(), and mitk::ImageWriter::WriteByITK().
{ return m_LargestPossibleRegion; }
unsigned int mitk::SlicedData::GetNumberOfChannels | ( | ) | const [inline] |
Get the number of channels.
Definition at line 145 of file mitkSlicedData.h.
{ return m_LargestPossibleRegion.GetSize(4); }
virtual const RegionType& mitk::SlicedData::GetRequestedRegion | ( | ) | const [inline, virtual] |
Get the region object that defines the size and starting index for the region of the image requested (i.e., the region of the image to be operated on by a filter).
Definition at line 133 of file mitkSlicedData.h.
Referenced by mitk::ManualSegmentationToSurfaceFilter::GenerateData(), mitk::LabeledImageToSurfaceFilter::GenerateData(), mitk::ImageToSurfaceFilter::GenerateData(), SetRequestedRegion(), and mitk::ImageSource::SplitRequestedRegion().
{ return m_RequestedRegion; }
mitk::SlicedGeometry3D * mitk::SlicedData::GetSlicedGeometry | ( | unsigned int | t = 0 ) |
const |
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it).
No update will be called. Normally used in GenerateOutputInformation of subclasses of BaseProcess.
Definition at line 228 of file mitkSlicedData.cpp.
Referenced by mitk::SegTool2D::DetermineAffectedImageSlice(), mitk::LabeledImageToSurfaceFilter::GetVolumeForLabel(), and mitk::ImageMapperGL2D::Paint().
{ if(GetTimeSlicedGeometry() == NULL) return NULL; return dynamic_cast<SlicedGeometry3D*>(GetTimeSlicedGeometry()->GetGeometry3D(t)); }
const mitk::SlicedGeometry3D * mitk::SlicedData::GetUpdatedSlicedGeometry | ( | unsigned int | t = 0 ) |
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it).
The method does not simply return the value of the m_Geometry3D member. Before doing this, it makes sure that the Geometry3D is up-to-date before returning it (by setting the update extent appropriately and calling UpdateOutputInformation).
Definition at line 235 of file mitkSlicedData.cpp.
{ SetRequestedRegionToLargestPossibleRegion(); UpdateOutputInformation(); return GetSlicedGeometry(t); }
virtual bool mitk::SlicedData::IsChannelSet | ( | int | n = 0 ) |
const [pure virtual] |
Implemented in mitk::Image.
virtual bool mitk::SlicedData::IsSliceSet | ( | int | s = 0 , |
int | t = 0 , |
||
int | n = 0 |
||
) | const [pure virtual] |
Implemented in mitk::Image.
virtual bool mitk::SlicedData::IsVolumeSet | ( | int | t = 0 , |
int | n = 0 |
||
) | const [pure virtual] |
Implemented in mitk::Image.
mitk::SlicedData::itkStaticConstMacro | ( | RegionDimension | , |
unsigned | int, | ||
5 | |||
) |
void mitk::SlicedData::PrepareForNewData | ( | ) | [virtual] |
Definition at line 62 of file mitkSlicedData.cpp.
{
if ( GetUpdateMTime() < GetPipelineMTime() || GetDataReleased() )
{
ReleaseData();
}
}
bool mitk::SlicedData::RequestedRegionIsOutsideOfTheBufferedRegion | ( | ) | [virtual] |
Determine whether the RequestedRegion is outside of the BufferedRegion. This method returns true if the RequestedRegion is outside the BufferedRegion (true if at least one pixel is outside). This is used by the pipeline mechanism to determine whether a filter needs to re-execute in order to satisfy the current request. If the current RequestedRegion is already inside the BufferedRegion from the previous execution (and the current filter is up to date), then a given filter does not need to re-execute
Implements mitk::BaseData.
Definition at line 85 of file mitkSlicedData.cpp.
References QuadProgPP::t().
{ // Is the requested region within the currently buffered data? // SlicedData and subclasses store entire volumes or slices. The // methods IsVolumeSet() and IsSliceSet are provided to check, // a volume or slice, respectively, is available. Thus, these // methods used here. const IndexType &requestedRegionIndex = m_RequestedRegion.GetIndex(); const SizeType& requestedRegionSize = m_RequestedRegion.GetSize(); const SizeType& largestPossibleRegionSize = GetLargestPossibleRegion().GetSize(); // are whole channels requested? int c, cEnd; c=requestedRegionIndex[4]; cEnd=c+static_cast<long>(requestedRegionSize[4]); if(requestedRegionSize[3] == largestPossibleRegionSize[3]) { for (; c< cEnd; ++c) if(IsChannelSet(c)==false) return true; return false; } // are whole volumes requested? int t, tEnd; t=requestedRegionIndex[3]; tEnd=t+static_cast<long>(requestedRegionSize[3]); if(requestedRegionSize[2] == largestPossibleRegionSize[2]) { for (; c< cEnd; ++c) for (; t< tEnd; ++t) if(IsVolumeSet(t, c)==false) return true; return false; } // ok, only slices are requested. Check if they are available. int s, sEnd; s=requestedRegionIndex[2]; sEnd=s+static_cast<long>(requestedRegionSize[2]); for (; c< cEnd; ++c) for (; t< tEnd; ++t) for (; s< sEnd; ++s) if(IsSliceSet(s, t, c)==false) return true; return false; }
void mitk::SlicedData::SetGeometry | ( | Geometry3D * | aGeometry3D ) | [virtual] |
Set the Geometry3D of the data, which will be referenced (not copied!). It has to be a sub-class of SlicedGeometry3D.
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Image.
Definition at line 244 of file mitkSlicedData.cpp.
References mitk::Geometry3D::GetExtent(), mitk::TimeSlicedGeometry::New(), mitk::PlaneGeometry::New(), and mitk::SlicedGeometry3D::New().
{ if(aGeometry3D!=NULL) { TimeSlicedGeometry::Pointer timeSlicedGeometry = dynamic_cast<TimeSlicedGeometry*>(aGeometry3D); if(timeSlicedGeometry.IsNull()) { SlicedGeometry3D::Pointer slicedGeometry = dynamic_cast<SlicedGeometry3D*>(aGeometry3D); if(slicedGeometry.IsNull()) { Geometry2D* geometry2d = dynamic_cast<Geometry2D*>(aGeometry3D); if(geometry2d!=NULL) { if((GetSlicedGeometry()->GetGeometry2D(0)==geometry2d) && (GetSlicedGeometry()->GetSlices()==1)) return; slicedGeometry = SlicedGeometry3D::New(); slicedGeometry->InitializeEvenlySpaced(geometry2d, 1); } else { slicedGeometry = SlicedGeometry3D::New(); PlaneGeometry::Pointer planeGeometry = PlaneGeometry::New(); planeGeometry->InitializeStandardPlane(aGeometry3D); slicedGeometry->InitializeEvenlySpaced(planeGeometry, (unsigned int)(aGeometry3D->GetExtent(2))); } } assert(slicedGeometry.IsNotNull()); timeSlicedGeometry = TimeSlicedGeometry::New(); timeSlicedGeometry->InitializeEvenlyTimed(slicedGeometry, 1); } Superclass::SetGeometry(timeSlicedGeometry); } else { if(GetGeometry()==NULL) return; Superclass::SetGeometry(NULL); } }
virtual void mitk::SlicedData::SetOrigin | ( | const Point3D & | origin ) | [virtual] |
Convenience method for setting the origin of the SlicedGeometry3D instances of all time steps.
In case the SlicedGeometry3D is evenly spaced, the origin of the first slice is set to origin.
Reimplemented from mitk::BaseData.
void mitk::SlicedData::SetRequestedRegion | ( | SlicedData::RegionType * | region ) | [virtual] |
Set the requested region from this data object to match the requested region of the data object passed in as a parameter. This method is implemented in the concrete subclasses of DataObject.
Definition at line 183 of file mitkSlicedData.cpp.
{ m_UseLargestPossibleRegion=false; if(region!=NULL) { m_RequestedRegion = *region; m_RequestedRegionInitialized = true; } else { // pointer could not be cast back down itkExceptionMacro( << "mitk::SlicedData::SetRequestedRegion(SlicedData::RegionType*) cannot cast " << typeid(region).name() << " to " << typeid(SlicedData*).name() ); } }
void mitk::SlicedData::SetRequestedRegion | ( | itk::DataObject * | data ) | [virtual] |
Set the requested region from this data object to match the requested region of the data object passed in as a parameter. This method is implemented in the concrete subclasses of DataObject.
Implements mitk::BaseData.
Definition at line 163 of file mitkSlicedData.cpp.
References GetRequestedRegion().
Referenced by mitk::ImageMapperGL2D::GenerateData(), mitk::ExtractDirectedPlaneImageFilter::GenerateData(), mitk::ProbeFilter::GenerateInputRequestedRegion(), mitk::ImageToImageFilter::GenerateInputRequestedRegion(), and mitk::ImageSource::GraftNthOutput().
{ m_UseLargestPossibleRegion=false; mitk::SlicedData *slicedData; slicedData = dynamic_cast<mitk::SlicedData*>(data); if (slicedData) { m_RequestedRegion = slicedData->GetRequestedRegion(); m_RequestedRegionInitialized = true; } else { // pointer could not be cast back down itkExceptionMacro( << "mitk::SlicedData::SetRequestedRegion(DataObject*) cannot cast " << typeid(data).name() << " to " << typeid(SlicedData*).name() ); } }
void mitk::SlicedData::SetRequestedRegionToLargestPossibleRegion | ( | ) | [virtual] |
Set the RequestedRegion to the LargestPossibleRegion. This forces a filter to produce all of the output in one execution (i.e. not streaming) on the next call to Update().
Implements mitk::BaseData.
Definition at line 70 of file mitkSlicedData.cpp.
Referenced by mitk::RGBToRGBACastImageFilter::GenerateInputRequestedRegion(), mitk::MaskImageFilter::GenerateInputRequestedRegion(), mitk::GeometryClipImageFilter::GenerateInputRequestedRegion(), and mitk::HeightFieldSurfaceClipImageFilter::GenerateOutputInformation().
{ m_UseLargestPossibleRegion = true; if(GetGeometry()==NULL) return; unsigned int i; const RegionType::IndexType & index = GetLargestPossibleRegion().GetIndex(); const RegionType::SizeType & size = GetLargestPossibleRegion().GetSize(); for(i=0;i<RegionDimension;++i) { m_RequestedRegion.SetIndex(i, index[i]); m_RequestedRegion.SetSize(i, size[i]); } }
void mitk::SlicedData::SetSpacing | ( | const float | aSpacing[3] ) | [virtual] |
Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps.
Definition at line 285 of file mitkSlicedData.cpp.
{ this->SetSpacing((mitk::Vector3D)aSpacing); }
void mitk::SlicedData::SetSpacing | ( | mitk::Vector3D | aSpacing ) | [virtual] |
Convenience method for setting the spacing of the SlicedGeometry3D instances of all time steps.
Definition at line 321 of file mitkSlicedData.cpp.
References mitk::TimeSlicedGeometry::GetTimeSteps(), and mitk::SlicedGeometry3D::SetSpacing().
{ mitk::TimeSlicedGeometry* timeSlicedGeometry = GetTimeSlicedGeometry(); assert(timeSlicedGeometry!=NULL); mitk::SlicedGeometry3D* slicedGeometry; unsigned int steps = timeSlicedGeometry->GetTimeSteps(); for(unsigned int timestep = 0; timestep < steps; ++timestep) { slicedGeometry = GetSlicedGeometry(timestep); if(slicedGeometry != NULL) { slicedGeometry->SetSpacing(aSpacing); } if(GetTimeSlicedGeometry()->GetEvenlyTimed()) { GetTimeSlicedGeometry()->InitializeEvenlyTimed(slicedGeometry, steps); break; } } }
void mitk::SlicedData::UpdateOutputInformation | ( | ) | [virtual] |
Update the information for this DataObject so that it can be used as an output of a ProcessObject. This method is used in the pipeline mechanism to propagate information and initialize the meta data associated with a itk::DataObject. Any implementation of this method in a derived class of itk::DataObject is assumed to call its source's ProcessObject::UpdateOutputInformation() which determines modified times, LargestPossibleRegions, and any extra meta data like spacing, origin, etc.
Reimplemented from mitk::BaseData.
Definition at line 38 of file mitkSlicedData.cpp.
Referenced by mitk::ImageMapperGL2D::Update().
{ Superclass::UpdateOutputInformation(); if (this->GetSource() == false) // If we don't have a source, then let's make our Image // span our buffer { m_UseLargestPossibleRegion = true; } // Now we should know what our largest possible region is. If our // requested region was not set yet, (or has been set to something // invalid - with no data in it ) then set it to the largest possible // region. if ( ! m_RequestedRegionInitialized) { this->SetRequestedRegionToLargestPossibleRegion(); m_RequestedRegionInitialized = true; } m_LastRequestedRegionWasOutsideOfTheBufferedRegion = 0; }
bool mitk::SlicedData::VerifyRequestedRegion | ( | ) | [virtual] |
Verify that the RequestedRegion is within the LargestPossibleRegion.
Verify that the RequestedRegion is within the LargestPossibleRegion. If the RequestedRegion is not within the LargestPossibleRegion, then the filter cannot possibly satisfy the request. This method returns true if the request can be satisfied (even if it will be necessary to process the entire LargestPossibleRegion) and returns false otherwise. This method is used by PropagateRequestedRegion(). PropagateRequestedRegion() throws a InvalidRequestedRegionError exception if the requested region is not within the LargestPossibleRegion.
Implements mitk::BaseData.
Definition at line 133 of file mitkSlicedData.cpp.
{ if(GetTimeSlicedGeometry() == NULL) return false; unsigned int i; // Is the requested region within the LargestPossibleRegion? // Note that the test is indeed against the largest possible region // rather than the buffered region; see DataObject::VerifyRequestedRegion. const IndexType &requestedRegionIndex = m_RequestedRegion.GetIndex(); const IndexType &largestPossibleRegionIndex = GetLargestPossibleRegion().GetIndex(); const SizeType& requestedRegionSize = m_RequestedRegion.GetSize(); const SizeType& largestPossibleRegionSize = GetLargestPossibleRegion().GetSize(); for (i=0; i< RegionDimension; ++i) { if ( (requestedRegionIndex[i] < largestPossibleRegionIndex[i]) || ((requestedRegionIndex[i] + static_cast<long>(requestedRegionSize[i])) > (largestPossibleRegionIndex[i]+static_cast<long>(largestPossibleRegionSize[i])))) { return false; } } return true; }
RegionType mitk::SlicedData::m_BufferedRegion [protected] |
Definition at line 216 of file mitkSlicedData.h.
RegionType mitk::SlicedData::m_LargestPossibleRegion [protected] |
Definition at line 213 of file mitkSlicedData.h.
Referenced by SlicedData().
RegionType mitk::SlicedData::m_RequestedRegion [protected] |
Definition at line 215 of file mitkSlicedData.h.
bool mitk::SlicedData::m_UseLargestPossibleRegion [protected] |
Definition at line 217 of file mitkSlicedData.h.