Describes a geometry consisting of several geometries which exist at different times. More...
#include <mitkTimeSlicedGeometry.h>
Public Types | |
typedef TimeSlicedGeometry | Self |
typedef Geometry3D | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
Method for creation through the object factory. | |
void | UpdateInformation () |
Re-calculate the hull of the contained geometries. | |
virtual unsigned int | GetTimeSteps () const |
Get the number of time-steps. | |
virtual bool | GetEvenlyTimed () const |
Set/Get whether the TimeSlicedGeometry is evenly-timed (m_EvenlyTimed) | |
virtual void | SetEvenlyTimed (bool on=true) |
virtual bool | SetGeometry3D (mitk::Geometry3D *geometry3D, int t) |
Set the Geometry3D for time t. | |
virtual mitk::Geometry3D * | GetGeometry3D (int t) const |
Get the Geometry3D at time t. | |
virtual bool | IsValidTime (int t) const |
Test whether t is a valid time step. | |
virtual int | MSToTimeStep (mitk::ScalarType time_in_ms) const |
Convert time in ms to a time step. | |
virtual mitk::ScalarType | TimeStepToMS (int timestep) const |
Convert time step to time in ms. | |
virtual int | TimeStepToTimeStep (const mitk::TimeSlicedGeometry *referenceGeometry, int t) const |
Convert time step in the reference TimeSlicedGeometry to time step in this TimeSlicedGeometry. | |
virtual void | Initialize (unsigned int timeSteps) |
Completely initialize this instance as evenly-timed with timeSteps geometries of type Geometry3D, each initialized by Geometry3D::Initialize(). | |
virtual void | InitializeEvenlyTimed (mitk::Geometry3D *geometry3D, unsigned int timeSteps) |
Completely initialize this instance as evenly-timed with timeSteps geometries identical to the provided Geometry3D except for the time bounds. | |
virtual void | InitializeEmpty (unsigned int timeSteps) |
Initialize this instance to contain timeSteps geometries, but without setting them yet. | |
virtual void | ExpandToNumberOfTimeSteps (unsigned int timeSteps) |
Expand the number of time steps contained to timeSteps. | |
virtual void | SetImageGeometry (const bool isAnImageGeometry) |
Define that this Geometry3D is refering to an Image. | |
void | CopyTimes (const mitk::TimeSlicedGeometry *timeslicedgeometry, unsigned int t=0, unsigned int endtimeindex=itk::NumericTraits< unsigned int >::max()) |
Copy the m_TimeBounds of the geometries contained in timeslicedgeometry into the geometries contained in this TimeSlicedGeometry object. | |
virtual AffineGeometryFrame3D::Pointer | Clone () const |
duplicates the geometry | |
virtual void | ExecuteOperation (Operation *operation) |
executes affine operations (translate, rotate, scale) | |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
TimeSlicedGeometry () | |
virtual | ~TimeSlicedGeometry () |
void | InitializeGeometry (Self *newGeometry) const |
used in clone to initialize the newly created geometry | |
virtual void | PrintSelf (std::ostream &os, itk::Indent indent) const |
Protected Attributes | |
std::vector< Geometry3D::Pointer > | m_Geometry3Ds |
unsigned int | m_TimeSteps |
Number of time steps. | |
bool | m_EvenlyTimed |
true in case the time steps have equal length | |
Static Protected Attributes | |
static const std::string | EVENLY_TIMED |
static const std::string | TIME_STEPS |
Describes a geometry consisting of several geometries which exist at different times.
The geometry contains m_TimeSteps geometries, which can be accessed using GetGeometry3D(int t). To convert between world-time in milliseconds and the integer timestep-number use MSToTimeStep. The hull (in space and time) of the TimeSlicedGeometry contains all contained geometries.
TimeSlicedGeometry and the associated Geometry3Ds have to be initialized in the method GenerateOutputInformation() of BaseProcess (or CopyInformation/ UpdateOutputInformation of BaseData, if possible, e.g., by analyzing pic tags in Image) subclasses. See also itk::ProcessObject::GenerateOutputInformation(), itk::DataObject::CopyInformation() and itk::DataObject::UpdateOutputInformation().
Definition at line 48 of file mitkTimeSlicedGeometry.h.
typedef itk::SmartPointer<const Self> mitk::TimeSlicedGeometry::ConstPointer |
Reimplemented from mitk::Geometry3D.
Definition at line 51 of file mitkTimeSlicedGeometry.h.
typedef itk::SmartPointer<Self> mitk::TimeSlicedGeometry::Pointer |
Reimplemented from mitk::Geometry3D.
Definition at line 51 of file mitkTimeSlicedGeometry.h.
Reimplemented from mitk::Geometry3D.
Definition at line 51 of file mitkTimeSlicedGeometry.h.
Reimplemented from mitk::Geometry3D.
Definition at line 51 of file mitkTimeSlicedGeometry.h.
mitk::TimeSlicedGeometry::TimeSlicedGeometry | ( | ) | [protected] |
Definition at line 293 of file mitkTimeSlicedGeometry.cpp.
: m_TimeSteps(0), m_EvenlyTimed(false) { }
mitk::TimeSlicedGeometry::~TimeSlicedGeometry | ( | ) | [protected, virtual] |
Definition at line 297 of file mitkTimeSlicedGeometry.cpp.
{ }
mitk::AffineGeometryFrame3D::Pointer mitk::TimeSlicedGeometry::Clone | ( | ) | const [virtual] |
duplicates the geometry
Reimplemented from mitk::Geometry3D.
Definition at line 346 of file mitkTimeSlicedGeometry.cpp.
Referenced by mitk::BaseData::CopyInformation(), and mitk::Tool::CreateEmptySegmentationNode().
{ Self::Pointer newGeometry = Self::New(); newGeometry->Initialize(m_TimeSteps); InitializeGeometry(newGeometry); return newGeometry.GetPointer(); }
void mitk::TimeSlicedGeometry::CopyTimes | ( | const mitk::TimeSlicedGeometry * | timeslicedgeometry, |
unsigned int | t = 0 , |
||
unsigned int | endtimeindex = itk::NumericTraits<unsigned int>::max() |
||
) |
Copy the m_TimeBounds of the geometries contained in timeslicedgeometry into the geometries contained in this TimeSlicedGeometry object.
Useful for initialization of the TimeSlicedGeometry of the output in GenerateOutputInformation() methods of process objects, see for example BoundingObjectCutter::GenerateOutputInformation().
t | start time index |
endtimeindex | (endtimeindex) is the time index of the last geometry whose time-bounds are copied. If timeslicedgeometry or this TimeSlicedGeometry object does not contain enough geometries, endtimeindex is reduced appropriately. |
Definition at line 327 of file mitkTimeSlicedGeometry.cpp.
References GetGeometry3D(), mitk::Geometry3D::GetTimeBounds(), GetTimeSteps(), mitk::Geometry3D::SetTimeBounds(), and QuadProgPP::t().
Referenced by mitk::AutoCropImageFilter::GenerateOutputInformation().
{ if(endtimeindex >= timeslicedgeometry->GetTimeSteps()) endtimeindex = timeslicedgeometry->GetTimeSteps()-1; if(endtimeindex >= this->GetTimeSteps()) endtimeindex = this->GetTimeSteps()-1; for(; t <= endtimeindex; ++t) { mitk::Geometry3D* geometry3d = GetGeometry3D(t); mitk::Geometry3D* othergeometry3d = timeslicedgeometry->GetGeometry3D(t); assert((geometry3d!=NULL) && (othergeometry3d!=NULL)); geometry3d->SetTimeBounds(othergeometry3d->GetTimeBounds()); } UpdateInformation(); }
void mitk::TimeSlicedGeometry::ExecuteOperation | ( | Operation * | operation ) | [virtual] |
executes affine operations (translate, rotate, scale)
Reimplemented from mitk::Geometry3D.
Definition at line 388 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::ExecuteOperation().
{ // reach through to all time steps for (std::vector<Geometry3D::Pointer>::iterator iter = m_Geometry3Ds.begin(); iter != m_Geometry3Ds.end(); ++iter) { (*iter)->ExecuteOperation(operation); } Geometry3D::ExecuteOperation(operation); this->Modified(); }
void mitk::TimeSlicedGeometry::ExpandToNumberOfTimeSteps | ( | unsigned int | timeSteps ) | [virtual] |
Expand the number of time steps contained to timeSteps.
New, additional time steps will be initialized empty. Only enlargement of the time steps vector is intended and possible.
Definition at line 267 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::GetTimeBounds(), and QuadProgPP::max().
{ if( timeSteps <= m_TimeSteps ) return; if(m_TimeSteps == 1) { Geometry3D* g3d = m_Geometry3Ds[0]; const TimeBounds & timeBounds = g3d->GetTimeBounds(); if( (timeBounds[0] == ScalarTypeNumericTraits::NonpositiveMin()) || (timeBounds[1]==ScalarTypeNumericTraits::max()) ) { mitk::ScalarType timeBounds[] = {0.0, 1.0}; m_Geometry3Ds[0]->SetTimeBounds( timeBounds ); } } // Expand to Number of time steps; initialize with empty geometries Geometry3D::Pointer gnull=NULL; m_Geometry3Ds.resize(timeSteps, gnull); m_TimeSteps = timeSteps; UpdateInformation(); }
virtual const char* mitk::TimeSlicedGeometry::GetClassName | ( | ) | const [virtual] |
Method for creation through the object factory.
Reimplemented from mitk::Geometry3D.
virtual bool mitk::TimeSlicedGeometry::GetEvenlyTimed | ( | ) | const [virtual] |
Set/Get whether the TimeSlicedGeometry is evenly-timed (m_EvenlyTimed)
If (a) we don't have a Geometry3D stored for the requested time, (b) m_EvenlyTimed is activated and (c) the first geometry (t=0) is set, then we clone the geometry and set the m_TimeBounds accordingly.
mitk::Geometry3D * mitk::TimeSlicedGeometry::GetGeometry3D | ( | int | t ) | const [virtual] |
Get the Geometry3D at time t.
Definition at line 106 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::Clone(), mitk::Geometry3D::GetTimeBounds(), QuadProgPP::max(), and QuadProgPP::t().
Referenced by mitk::UnstructuredGrid::CalculateBoundingBox(), mitk::Surface::CalculateBoundingBox(), CopyTimes(), mitk::SlicesRotator::ExecuteAction(), mitk::MoveSurfaceInteractor::ExecuteAction(), mitk::AffineInteractor::ExecuteAction(), mitk::ImageWriter::GenerateData(), mitk::ImageMapperGL2D::GenerateData(), mitk::ExtractDirectedPlaneImageFilter::GenerateData(), mitk::Geometry2DDataToSurfaceFilter::GenerateOutputInformation(), QmitkSlicesInterpolator::GetSliceForWindowsID(), mitkPicFileReaderTest(), mitk::SurfaceToImageFilter::Stencil3DImage(), QmitkSlicesInterpolator::TranslateAndInterpolateChangedSlice(), and UpdateInformation().
{ mitk::Geometry3D::Pointer geometry3d = NULL; if(IsValidTime(t)) { geometry3d = m_Geometry3Ds[t]; //if (a) we don't have a Geometry3D stored for the requested time, //(b) m_EvenlyTimed is activated and (c) the first geometry (t=0) //is set, then we clone the geometry and set the m_TimeBounds accordingly. if((m_EvenlyTimed) && (geometry3d.IsNull())) { const Geometry3D* firstgeometry=m_Geometry3Ds[0].GetPointer(); assert(firstgeometry != NULL); mitk::Geometry3D::Pointer requestedgeometry; requestedgeometry = dynamic_cast<Geometry3D*>(firstgeometry->Clone().GetPointer()); if ( requestedgeometry.IsNull() ) itkExceptionMacro("Geometry is NULL!"); TimeBounds timebounds = requestedgeometry->GetTimeBounds(); if(timebounds[1]<ScalarTypeNumericTraits::max()) { mitk::ScalarType later = (timebounds[1]-timebounds[0])*t; timebounds[0]+=later; timebounds[1]+=later; requestedgeometry->SetTimeBounds(timebounds); } geometry3d = requestedgeometry; m_Geometry3Ds[t] = geometry3d; } } else return NULL; return geometry3d; }
virtual unsigned int mitk::TimeSlicedGeometry::GetTimeSteps | ( | ) | const [virtual] |
Get the number of time-steps.
Referenced by mitk::UnstructuredGrid::CalculateBoundingBox(), mitk::Surface::CalculateBoundingBox(), mitk::DataStorage::ComputeBoundingGeometry3D(), CopyTimes(), mitk::OdfVtkMapper2D< TPixelType, NrOdfDirections >::GenerateData(), mitk::ExtractDirectedPlaneImageFilter::GenerateData(), mitk::MaskImageFilter::GenerateInputRequestedRegion(), mitk::LabeledImageToSurfaceFilter::GenerateOutputInformation(), mitk::VectorImageMapper2D::GetCurrentTimeStep(), mitk::Image::Initialize(), mitk::BaseData::IsEmpty(), mitkPicFileReaderTest(), mitk::SurfaceGLMapper2D::Paint(), mitk::PointSetGLMapper2D::Paint(), mitk::MeshMapper2D::Paint(), mitk::SlicedData::SetSpacing(), TimeStepToTimeStep(), mitk::Mapper::Update(), mitk::ImageMapperGL2D::Update(), and mitk::PointSet::UpdateOutputInformation().
void mitk::TimeSlicedGeometry::Initialize | ( | unsigned int | timeSteps ) | [virtual] |
Completely initialize this instance as evenly-timed with timeSteps geometries of type Geometry3D, each initialized by Geometry3D::Initialize().
Definition at line 222 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::New().
Referenced by mitk::BoundingObjectGroup::BoundingObjectGroup(), mitk::ContourSet::ContourSet(), and mitk::ExtrudedContour::ExtrudedContour().
{ Geometry3D::Pointer geometry3D = Geometry3D::New(); geometry3D->Initialize(); InitializeEvenlyTimed(geometry3D, timeSteps); }
void mitk::TimeSlicedGeometry::InitializeEmpty | ( | unsigned int | timeSteps ) | [virtual] |
Initialize this instance to contain timeSteps geometries, but without setting them yet.
Definition at line 254 of file mitkTimeSlicedGeometry.cpp.
{ m_IndexToWorldTransform = NULL; Superclass::Initialize(); m_TimeSteps = timeSteps; // initialize with empty geometries Geometry3D::Pointer gnull=NULL; m_Geometry3Ds.assign(m_TimeSteps, gnull); }
void mitk::TimeSlicedGeometry::InitializeEvenlyTimed | ( | mitk::Geometry3D * | geometry3D, |
unsigned int | timeSteps | ||
) | [virtual] |
Completely initialize this instance as evenly-timed with timeSteps geometries identical to the provided Geometry3D except for the time bounds.
Definition at line 229 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::GetBounds(), mitk::Geometry3D::GetFrameOfReferenceID(), mitk::Geometry3D::GetImageGeometry(), and mitk::Geometry3D::GetIndexToWorldTransform().
Referenced by mitk::AutoCropImageFilter::GenerateOutputInformation(), and mitk::Geometry2DData::SetGeometry2D().
{ assert(geometry3D!=NULL); geometry3D->Register(); InitializeEmpty(timeSteps); AffineTransform3D::Pointer transform = AffineTransform3D::New(); transform->SetMatrix(geometry3D->GetIndexToWorldTransform()->GetMatrix()); transform->SetOffset(geometry3D->GetIndexToWorldTransform()->GetOffset()); SetIndexToWorldTransform(transform); SetBounds(geometry3D->GetBounds()); SetGeometry3D(geometry3D, 0); SetEvenlyTimed(); UpdateInformation(); SetFrameOfReferenceID(geometry3D->GetFrameOfReferenceID()); SetImageGeometry(geometry3D->GetImageGeometry()); geometry3D->UnRegister(); }
void mitk::TimeSlicedGeometry::InitializeGeometry | ( | Self * | newGeometry ) | const [protected, virtual] |
used in clone to initialize the newly created geometry
Has to be overwritten in sub-classes, if they add members. Do the following:
Reimplemented from mitk::Geometry3D.
Definition at line 354 of file mitkTimeSlicedGeometry.cpp.
References QuadProgPP::t().
{ Superclass::InitializeGeometry(newGeometry); newGeometry->SetEvenlyTimed(m_EvenlyTimed); unsigned int t; for(t=0; t<m_TimeSteps; ++t) { if(m_Geometry3Ds[t].IsNull()) { assert(m_EvenlyTimed); } else { newGeometry->SetGeometry3D(dynamic_cast<Geometry3D*>(m_Geometry3Ds[t]->Clone().GetPointer()), t); } } }
bool mitk::TimeSlicedGeometry::IsValidTime | ( | int | t ) | const [virtual] |
Test whether t is a valid time step.
Definition at line 322 of file mitkTimeSlicedGeometry.cpp.
References int().
Referenced by mitk::OdfVtkMapper2D< TPixelType, NrOdfDirections >::GenerateData(), mitk::ExtractDirectedPlaneImageFilter::GenerateData(), mitk::ProbeFilter::GenerateInputRequestedRegion(), mitk::GenerateTimeInInputRegion(), mitk::VectorImageMapper2D::GetCurrentTimeStep(), mitk::SurfaceGLMapper2D::Paint(), mitk::PointSetGLMapper2D::Paint(), mitk::MeshMapper2D::Paint(), mitk::Mapper::Update(), and mitk::ImageMapperGL2D::Update().
{ return (t>=0) && (t< (int)m_TimeSteps); }
int mitk::TimeSlicedGeometry::MSToTimeStep | ( | mitk::ScalarType | time_in_ms ) | const [virtual] |
Convert time in ms to a time step.
Definition at line 152 of file mitkTimeSlicedGeometry.cpp.
References QuadProgPP::max(), and QuadProgPP::t().
Referenced by mitk::RGBToRGBACastImageFilter::GenerateData(), mitk::ProbeFilter::GenerateData(), mitk::MaskImageFilter::GenerateData(), mitk::GeometryClipImageFilter::GenerateData(), mitk::ExtractDirectedPlaneImageFilter::GenerateData(), mitk::ProbeFilter::GenerateInputRequestedRegion(), mitk::GenerateTimeInInputRegion(), mitk::VectorImageMapper2D::GetCurrentTimeStep(), mitk::BaseRenderer::GetTimeStep(), mitkSurfaceTest(), mitk::SurfaceGLMapper2D::Paint(), mitk::PointSetGLMapper2D::Paint(), and mitk::MeshMapper2D::Paint().
{ if(time_in_ms < m_TimeBounds[0]) return -1; if(time_in_ms >= m_TimeBounds[1]) return m_TimeSteps; if(m_EvenlyTimed) { if(m_TimeBounds[0] == m_TimeBounds[1]) return 0; if((m_TimeBounds[0]>ScalarTypeNumericTraits::NonpositiveMin()) && (m_TimeBounds[1]<ScalarTypeNumericTraits::max())) { return (int) ceil(((time_in_ms - m_TimeBounds[0])/(m_TimeBounds[1]-m_TimeBounds[0])*m_TimeSteps)-0.5); } return 0; } else { unsigned int t; for ( t = 0; t < m_TimeSteps; ++t ) { const TimeBounds& timeBounds = GetGeometry3D( t )->GetTimeBounds(); if( (timeBounds[0] <= time_in_ms) && (time_in_ms <= timeBounds[1]) ) { return t; } } } return 0; }
static Pointer mitk::TimeSlicedGeometry::New | ( | ) | [static] |
Method for creation through the object factory.
Reimplemented from mitk::Geometry3D.
Referenced by mitk::BaseData::BaseData(), mitk::DataStorage::ComputeBoundingGeometry3D(), mitk::ProbeFilter::GenerateOutputInformation(), mitk::Image::Initialize(), QmitkSliceWidget::InitWidget(), mitkBaseDataTest(), mitkTimeSlicedGeometryTest(), mitk::SlicedData::SetGeometry(), mitk::BaseData::SetGeometry(), and UpdateInformation().
void mitk::TimeSlicedGeometry::PrintSelf | ( | std::ostream & | os, |
itk::Indent | indent | ||
) | const [protected, virtual] |
Reimplemented from mitk::Geometry3D.
Definition at line 374 of file mitkTimeSlicedGeometry.cpp.
{ //Superclass::PrintSelf(os,indent); os << indent << " EvenlyTimed: " << m_EvenlyTimed << std::endl; os << indent << " TimeSteps: " << m_TimeSteps << std::endl; os << std::endl; os << indent << " GetGeometry3D(0): "; if(GetGeometry3D(0)==NULL) os << "NULL" << std::endl; else GetGeometry3D(0)->Print(os, indent); }
void mitk::TimeSlicedGeometry::SetEvenlyTimed | ( | bool | on = true ) |
[virtual] |
Definition at line 316 of file mitkTimeSlicedGeometry.cpp.
{ m_EvenlyTimed = on; Modified(); }
bool mitk::TimeSlicedGeometry::SetGeometry3D | ( | mitk::Geometry3D * | geometry3D, |
int | t | ||
) | [virtual] |
Set the Geometry3D for time t.
Definition at line 142 of file mitkTimeSlicedGeometry.cpp.
References QuadProgPP::t().
{ if(IsValidTime(t)) { m_Geometry3Ds[t]=geometry3D; return true; } return false; }
void mitk::TimeSlicedGeometry::SetImageGeometry | ( | const bool | _arg ) | [virtual] |
Define that this Geometry3D is refering to an Image.
A geometry referring to an Image needs a slightly different definition of the position of the corners (see GetCornerPoint). The position of a voxel is defined by the position of its center. If we would use the origin (position of the (center of) the first voxel) as a corner and display this point, it would seem to be not at the corner but a bit within the image. Even worse for the opposite corner of the image: here the corner would appear outside the image (by half of the voxel diameter). Thus, we have to correct for this and to be able to do that, we need to know that the Geometry3D is referring to an Image.
Reimplemented from mitk::Geometry3D.
Definition at line 302 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::SetImageGeometry(), and QuadProgPP::t().
{ Superclass::SetImageGeometry(isAnImageGeometry); mitk::Geometry3D* geometry3d; unsigned int t; for(t=0; t<m_TimeSteps; ++t) { geometry3d = m_Geometry3Ds[t]; if(geometry3d!=NULL) geometry3d->SetImageGeometry(isAnImageGeometry); } }
mitk::ScalarType mitk::TimeSlicedGeometry::TimeStepToMS | ( | int | timestep ) | const [virtual] |
Convert time step to time in ms.
Definition at line 183 of file mitkTimeSlicedGeometry.cpp.
References QuadProgPP::max().
Referenced by mitk::RGBToRGBACastImageFilter::GenerateData(), mitk::ProbeFilter::GenerateData(), mitk::MaskImageFilter::GenerateData(), mitk::GeometryClipImageFilter::GenerateData(), mitk::ProbeFilter::GenerateInputRequestedRegion(), mitk::GenerateTimeInInputRegion(), and TimeStepToTimeStep().
{ if(IsValidTime(timestep)==false) return ScalarTypeNumericTraits::max(); if(m_EvenlyTimed) { if ( timestep == 0 ) return m_TimeBounds[0]; else { assert( ! (m_TimeBounds[0] == ScalarTypeNumericTraits::NonpositiveMin() && m_TimeBounds[1] == ScalarTypeNumericTraits::max() ) ); return ((mitk::ScalarType)timestep)/m_TimeSteps*(m_TimeBounds[1]-m_TimeBounds[0])+m_TimeBounds[0]; } } else { return GetGeometry3D(timestep)->GetTimeBounds()[0]; } }
int mitk::TimeSlicedGeometry::TimeStepToTimeStep | ( | const mitk::TimeSlicedGeometry * | referenceGeometry, |
int | t | ||
) | const [virtual] |
Convert time step in the reference TimeSlicedGeometry to time step in this TimeSlicedGeometry.
Definition at line 203 of file mitkTimeSlicedGeometry.cpp.
References GetTimeSteps(), and TimeStepToMS().
Referenced by mitk::SurfaceToImageFilter::Stencil3DImage().
{ int timeStep; if ( referenceGeometry->GetTimeSteps() > 1 ) { // referenceGeometry is nD+t timeStep = this->MSToTimeStep( referenceGeometry->TimeStepToMS( t ) ); } else { // referenceGEometry is nD (only one time step) timeStep = 0; } return timeStep; }
void mitk::TimeSlicedGeometry::UpdateInformation | ( | ) |
Re-calculate the hull of the contained geometries.
The transforms, bounding-box and time-bounds of this geometry (stored in members of the super-class Geometry3D) are re-calculated from the contained geometries.
Definition at line 21 of file mitkTimeSlicedGeometry.cpp.
References mitk::Geometry3D::GetBoundingBox(), GetGeometry3D(), mitk::Geometry3D::GetIndexToWorldTransform(), mitk::Geometry3D::GetTimeBounds(), itk::AffineGeometryFrame< TScalarType, NDimensions >::m_BoundingBox, mitk::Geometry3D::m_TimeBounds, m_TimeSteps, QuadProgPP::max(), New(), mitk::Geometry3D::SetIndexToWorldTransform(), and QuadProgPP::t().
Referenced by mitk::BoundingObject::BoundingObject(), mitk::UnstructuredGrid::CalculateBoundingBox(), and mitk::Surface::CalculateBoundingBox().
{ if(m_TimeSteps==0) return; unsigned long maxModifiedTime = 0, curModifiedTime; mitk::ScalarType stmin, stmax; stmin= ScalarTypeNumericTraits::NonpositiveMin(); stmax= ScalarTypeNumericTraits::max(); TimeBounds timeBounds; timeBounds[0]=stmax; timeBounds[1]=stmin; mitk::BoundingBox::Pointer boundingBox=mitk::BoundingBox::New(); mitk::BoundingBox::PointsContainer::Pointer pointscontainer=mitk::BoundingBox::PointsContainer::New(); unsigned int t; mitk::Geometry3D* geometry3d; mitk::BoundingBox::ConstPointer nextBoundingBox; mitk::BoundingBox::PointIdentifier pointid=0; // Need to check for zero bounding boxes mitk::ScalarType zeropoint[]={0,0,0,0,0,0}; BoundingBox::BoundsArrayType itkBoundsZero(zeropoint); for(t=0; t < m_TimeSteps; ++t) { geometry3d = GetGeometry3D(t); assert(geometry3d!=NULL); curModifiedTime = geometry3d->GetMTime(); if(maxModifiedTime < curModifiedTime) maxModifiedTime = curModifiedTime; const TimeBounds & curTimeBounds = geometry3d->GetTimeBounds(); if((curTimeBounds[0] > stmin) && (curTimeBounds[0] < timeBounds[0])) timeBounds[0] = curTimeBounds[0]; if((curTimeBounds[1] < stmax) && (curTimeBounds[1] > timeBounds[1])) timeBounds[1] = curTimeBounds[1]; nextBoundingBox = geometry3d->GetBoundingBox(); assert(nextBoundingBox.IsNotNull()); // Only respect non-zero BBes if (nextBoundingBox->GetBounds() == itkBoundsZero) { continue; } const mitk::BoundingBox::PointsContainer * nextPoints = nextBoundingBox->GetPoints(); if(nextPoints!=NULL) { mitk::BoundingBox::PointsContainer::ConstIterator pointsIt = nextPoints->Begin(); while (pointsIt != nextPoints->End() ) { pointscontainer->InsertElement( pointid++, pointsIt->Value()); ++pointsIt; } } } if(!(timeBounds[0] < stmax)) { timeBounds[0] = stmin; timeBounds[1] = stmax; } m_TimeBounds = timeBounds; assert(timeBounds[0]<=timeBounds[1]); boundingBox->SetPoints(pointscontainer); boundingBox->ComputeBoundingBox(); m_BoundingBox = boundingBox; SetIndexToWorldTransform(GetGeometry3D(0)->GetIndexToWorldTransform()); if(this->GetMTime() < maxModifiedTime) Modified(); }
const std::string mitk::TimeSlicedGeometry::EVENLY_TIMED [static, protected] |
Definition at line 169 of file mitkTimeSlicedGeometry.h.
bool mitk::TimeSlicedGeometry::m_EvenlyTimed [protected] |
true in case the time steps have equal length
Definition at line 167 of file mitkTimeSlicedGeometry.h.
std::vector<Geometry3D::Pointer> mitk::TimeSlicedGeometry::m_Geometry3Ds [mutable, protected] |
Definition at line 159 of file mitkTimeSlicedGeometry.h.
unsigned int mitk::TimeSlicedGeometry::m_TimeSteps [protected] |
Number of time steps.
Definition at line 163 of file mitkTimeSlicedGeometry.h.
Referenced by UpdateInformation().
const std::string mitk::TimeSlicedGeometry::TIME_STEPS [static, protected] |
Definition at line 170 of file mitkTimeSlicedGeometry.h.