Class for storing unstructured grids (vtkUnstructuredGrid) More...
#include <mitkUnstructuredGrid.h>
Public Types | |
typedef itk::ImageRegion< 5 > | RegionType |
typedef UnstructuredGrid | Self |
typedef BaseData | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual void | SetVtkUnstructuredGrid (vtkUnstructuredGrid *grid, unsigned int t=0) |
virtual vtkUnstructuredGrid * | GetVtkUnstructuredGrid (unsigned int t=0) |
virtual void | UpdateOutputInformation () |
Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess. | |
virtual void | SetRequestedRegionToLargestPossibleRegion () |
Set the RequestedRegion to the LargestPossibleRegion. | |
virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
Determine whether the RequestedRegion is outside of the BufferedRegion. | |
virtual bool | VerifyRequestedRegion () |
Verify that the RequestedRegion is within the LargestPossibleRegion. | |
virtual void | SetRequestedRegion (itk::DataObject *data) |
Set the requested region from this data object to match the requested region of the data object passed in as a parameter. | |
virtual void | SetRequestedRegion (UnstructuredGrid::RegionType *region) |
virtual void | CopyInformation (const itk::DataObject *data) |
Copy information from the specified data set. | |
virtual void | Update () |
const RegionType & | GetLargestPossibleRegion () const |
virtual const RegionType & | GetRequestedRegion () const |
void | CalculateBoundingBox () |
Static Public Member Functions | |
static Pointer | New () |
Protected Types | |
typedef std::vector < vtkUnstructuredGrid * > | VTKUnstructuredGridSeries |
Protected Member Functions | |
virtual void | Expand (unsigned int timeSteps=1) |
Expands the TimeSlicedGeometry to a number of TimeSteps. | |
UnstructuredGrid () | |
virtual | ~UnstructuredGrid () |
virtual void | ClearData () |
reset to non-initialized state, release memory | |
virtual void | InitializeEmpty () |
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeSlicedGeometry() to ensure an existing valid geometry. | |
Protected Attributes | |
VTKUnstructuredGridSeries | m_GridSeries |
RegionType | m_LargestPossibleRegion |
RegionType | m_RequestedRegion |
bool | m_CalculateBoundingBox |
Class for storing unstructured grids (vtkUnstructuredGrid)
Definition at line 33 of file mitkUnstructuredGrid.h.
typedef itk::SmartPointer<const Self> mitk::UnstructuredGrid::ConstPointer |
Reimplemented from mitk::BaseData.
Definition at line 40 of file mitkUnstructuredGrid.h.
typedef itk::SmartPointer<Self> mitk::UnstructuredGrid::Pointer |
Reimplemented from mitk::BaseData.
Definition at line 40 of file mitkUnstructuredGrid.h.
typedef itk::ImageRegion< 5 > mitk::UnstructuredGrid::RegionType |
Definition at line 38 of file mitkUnstructuredGrid.h.
Reimplemented from mitk::BaseData.
Definition at line 40 of file mitkUnstructuredGrid.h.
Reimplemented from mitk::BaseData.
Definition at line 40 of file mitkUnstructuredGrid.h.
typedef std::vector< vtkUnstructuredGrid* > mitk::UnstructuredGrid::VTKUnstructuredGridSeries [protected] |
Definition at line 84 of file mitkUnstructuredGrid.h.
mitk::UnstructuredGrid::UnstructuredGrid | ( | ) | [protected] |
Definition at line 99 of file mitkUnstructuredGrid.cpp.
References InitializeEmpty().
: m_CalculateBoundingBox( false ) { this->InitializeEmpty(); }
mitk::UnstructuredGrid::~UnstructuredGrid | ( | ) | [protected, virtual] |
Definition at line 104 of file mitkUnstructuredGrid.cpp.
{ this->ClearData(); }
void mitk::UnstructuredGrid::CalculateBoundingBox | ( | ) |
Definition at line 121 of file mitkUnstructuredGrid.cpp.
References mitk::Geometry3D::GetBoundingBox(), mitk::TimeSlicedGeometry::GetGeometry3D(), mitk::TimeSlicedGeometry::GetTimeSteps(), mitk::Geometry3D::SetFloatBounds(), and mitk::TimeSlicedGeometry::UpdateInformation().
{ // // first make sure, that the associated time sliced geometry has // the same number of geometry 3d's as vtkUnstructuredGrids are present // mitk::TimeSlicedGeometry* timeGeometry = GetTimeSlicedGeometry(); if ( timeGeometry->GetTimeSteps() != m_GridSeries.size() ) { itkExceptionMacro(<<"timeGeometry->GetTimeSteps() != m_GridSeries.size() -- use Initialize(timeSteps) with correct number of timeSteps!"); } // // Iterate over the vtkUnstructuredGrids and update the Geometry // information of each of the items. // for ( unsigned int i = 0 ; i < m_GridSeries.size() ; ++i ) { vtkUnstructuredGrid* grid = m_GridSeries[ i ]; vtkFloatingPointType bounds[ ] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; if ( ( grid != 0 ) && ( grid->GetNumberOfCells() > 0 ) ) { grid->Update(); grid->ComputeBounds(); grid->GetBounds( bounds ); } mitk::Geometry3D::Pointer g3d = timeGeometry->GetGeometry3D( i ); assert( g3d.IsNotNull() ); g3d->SetFloatBounds( bounds ); } timeGeometry->UpdateInformation(); mitk::BoundingBox::Pointer bb = const_cast<mitk::BoundingBox*>( timeGeometry->GetBoundingBox() ); itkDebugMacro( << "boundingbox min: "<< bb->GetMinimum()); itkDebugMacro( << "boundingbox max: "<< bb->GetMaximum()); m_CalculateBoundingBox = false; }
void mitk::UnstructuredGrid::ClearData | ( | ) | [protected, virtual] |
reset to non-initialized state, release memory
Reimplemented from mitk::BaseData.
Definition at line 58 of file mitkUnstructuredGrid.cpp.
{ for ( VTKUnstructuredGridSeries::iterator it = m_GridSeries.begin(); it != m_GridSeries.end(); ++it ) { if ( ( *it ) != 0 ) ( *it )->Delete(); } m_GridSeries.clear(); Superclass::ClearData(); }
void mitk::UnstructuredGrid::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 218 of file mitkUnstructuredGrid.cpp.
Referenced by mitk::UnstructuredGridSource::GraftNthOutput().
{ Superclass::CopyInformation(data); }
void mitk::UnstructuredGrid::Expand | ( | unsigned int | timeSteps = 1 ) |
[protected, virtual] |
Expands the TimeSlicedGeometry to a number of TimeSteps.
The method expands the TimeSlicedGeometry to the given number of TimeSteps, filling newly created elements with empty geometries. Sub-classes should override this method to handle the elongation of their data vectors, too. Note that a shrinking is neither possible nor intended.
Reimplemented from mitk::BaseData.
Definition at line 45 of file mitkUnstructuredGrid.cpp.
Referenced by SetVtkUnstructuredGrid().
{ // check if the vector is long enough to contain the new element // at the given position. If not, expand it with sufficient zero-filled elements. if(timeSteps > m_GridSeries.size()) { Superclass::Expand(timeSteps); vtkUnstructuredGrid* pdnull = 0; m_GridSeries.resize( timeSteps, pdnull ); m_CalculateBoundingBox = true; } }
virtual const char* mitk::UnstructuredGrid::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::BaseData.
const RegionType& mitk::UnstructuredGrid::GetLargestPossibleRegion | ( | ) | const [inline] |
Definition at line 64 of file mitkUnstructuredGrid.h.
{ m_LargestPossibleRegion.SetIndex(3, 0); m_LargestPossibleRegion.SetSize(3, GetTimeSlicedGeometry()->GetTimeSteps()); return m_LargestPossibleRegion; }
virtual const RegionType& mitk::UnstructuredGrid::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 75 of file mitkUnstructuredGrid.h.
Referenced by SetRequestedRegion().
{ return m_RequestedRegion; }
vtkUnstructuredGrid * mitk::UnstructuredGrid::GetVtkUnstructuredGrid | ( | unsigned int | t = 0 ) |
[virtual] |
Definition at line 79 of file mitkUnstructuredGrid.cpp.
References QuadProgPP::t().
Referenced by mitk::UnstructuredGridVtkMapper3D::GenerateData(), and mitk::UnstructuredGridHistogram::Initialize().
{ if ( t < m_GridSeries.size() ) { vtkUnstructuredGrid* grid = m_GridSeries[ t ]; if((grid == 0) && (GetSource().GetPointer() != 0)) { RegionType requestedregion; requestedregion.SetIndex(3, t); requestedregion.SetSize(3, 1); SetRequestedRegion(&requestedregion); GetSource()->Update(); } grid = m_GridSeries[ t ]; return grid; } else return 0; }
void mitk::UnstructuredGrid::InitializeEmpty | ( | ) | [protected, virtual] |
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeSlicedGeometry() to ensure an existing valid geometry.
Reimplemented from mitk::BaseData.
Definition at line 70 of file mitkUnstructuredGrid.cpp.
Referenced by UnstructuredGrid().
{ vtkUnstructuredGrid* pdnull = 0; m_GridSeries.resize( 1, pdnull ); Superclass::InitializeTimeSlicedGeometry(1); m_Initialized = true; }
static Pointer mitk::UnstructuredGrid::New | ( | ) | [static] |
bool mitk::UnstructuredGrid::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 165 of file mitkUnstructuredGrid.cpp.
References QuadProgPP::t().
{ RegionType::IndexValueType end = m_RequestedRegion.GetIndex(3)+m_RequestedRegion.GetSize(3); if(((RegionType::IndexValueType)m_GridSeries.size()) < end) return true; for( RegionType::IndexValueType t=m_RequestedRegion.GetIndex(3); t < end; ++t ) if(m_GridSeries[t] == 0) return true; return false; }
void mitk::UnstructuredGrid::SetRequestedRegion | ( | UnstructuredGrid::RegionType * | region ) | [virtual] |
Definition at line 205 of file mitkUnstructuredGrid.cpp.
{ if(region != 0) { m_RequestedRegion = *region; } else { // pointer could not be cast back down itkExceptionMacro( << "mitk::UnstructuredGrid::SetRequestedRegion(UnstructuredGrid::RegionType*) cannot cast " << typeid(region).name() << " to " << typeid(UnstructuredGrid*).name() ); } }
void mitk::UnstructuredGrid::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 BaseData.
Implements mitk::BaseData.
Definition at line 188 of file mitkUnstructuredGrid.cpp.
References GetRequestedRegion().
Referenced by mitk::UnstructuredGridSource::GraftNthOutput().
{ mitk::UnstructuredGrid *gridData; gridData = dynamic_cast<mitk::UnstructuredGrid*>(data); if (gridData) { m_RequestedRegion = gridData->GetRequestedRegion(); } else { // pointer could not be cast back down itkExceptionMacro( << "mitk::UnstructuredGrid::SetRequestedRegion(DataObject*) cannot cast " << typeid(data).name() << " to " << typeid(UnstructuredGrid*).name() ); } }
void mitk::UnstructuredGrid::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 160 of file mitkUnstructuredGrid.cpp.
void mitk::UnstructuredGrid::SetVtkUnstructuredGrid | ( | vtkUnstructuredGrid * | grid, |
unsigned int | t = 0 |
||
) | [virtual] |
Definition at line 25 of file mitkUnstructuredGrid.cpp.
References Expand(), m_CalculateBoundingBox, m_GridSeries, and QuadProgPP::t().
{ this->Expand(t); if(m_GridSeries[ t ] != NULL) { m_GridSeries[ t ]->Delete(); } m_GridSeries[ t ] = grid; // call m_VtkPolyData->Register(NULL) to tell the reference counting that we // want to keep a reference on the object if (m_GridSeries[t] != 0) m_GridSeries[t]->Register(grid); this->Modified(); m_CalculateBoundingBox = true; }
void mitk::UnstructuredGrid::Update | ( | ) | [virtual] |
Definition at line 223 of file mitkUnstructuredGrid.cpp.
{ if ( GetSource() == 0 ) { for ( VTKUnstructuredGridSeries::iterator it = m_GridSeries.begin() ; it != m_GridSeries.end() ; ++it ) { if ( ( *it ) != 0 ) ( *it )->Update(); } } Superclass::Update(); }
void mitk::UnstructuredGrid::UpdateOutputInformation | ( | ) | [virtual] |
Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess.
This method is used in the pipeline mechanism to propagate information and initialize the meta data associated with a BaseData. Any implementation of this method in a derived class is assumed to call its source's BaseProcess::UpdateOutputInformation() which determines modified times, LargestPossibleRegions, and any extra meta data like spacing, origin, etc. Default implementation simply call's it's source's UpdateOutputInformation().
Reimplemented from mitk::BaseData.
Definition at line 109 of file mitkUnstructuredGrid.cpp.
{ if ( this->GetSource() ) { this->GetSource()->UpdateOutputInformation(); } if ( ( m_CalculateBoundingBox ) && ( m_GridSeries.size() > 0 ) ) CalculateBoundingBox(); else GetTimeSlicedGeometry()->UpdateInformation(); }
bool mitk::UnstructuredGrid::VerifyRequestedRegion | ( | ) | [virtual] |
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 179 of file mitkUnstructuredGrid.cpp.
{ if( (m_RequestedRegion.GetIndex(3)>=0) && (m_RequestedRegion.GetIndex(3)+m_RequestedRegion.GetSize(3)<=m_GridSeries.size()) ) return true; return false; }
bool mitk::UnstructuredGrid::m_CalculateBoundingBox [protected] |
Definition at line 104 of file mitkUnstructuredGrid.h.
Referenced by SetVtkUnstructuredGrid().
Definition at line 98 of file mitkUnstructuredGrid.h.
Referenced by SetVtkUnstructuredGrid().
RegionType mitk::UnstructuredGrid::m_LargestPossibleRegion [mutable, protected] |
Definition at line 100 of file mitkUnstructuredGrid.h.
RegionType mitk::UnstructuredGrid::m_RequestedRegion [protected] |
Definition at line 102 of file mitkUnstructuredGrid.h.