19 #include <vtkUnstructuredGrid.h>
45 if (timeSteps > m_GridSeries.size())
47 Superclass::Expand(timeSteps);
48 vtkUnstructuredGrid *pdnull =
nullptr;
49 m_GridSeries.resize(timeSteps, pdnull);
50 m_CalculateBoundingBox =
true;
56 for (
auto it = m_GridSeries.begin(); it != m_GridSeries.end(); ++it)
63 Superclass::ClearData();
68 vtkUnstructuredGrid *pdnull =
nullptr;
69 m_GridSeries.resize(1, pdnull);
70 Superclass::InitializeTimeGeometry(1);
77 if (t < m_GridSeries.size())
79 vtkUnstructuredGrid *grid = m_GridSeries[t];
80 if ((grid ==
nullptr) && (GetSource().GetPointer() !=
nullptr))
83 requestedregion.SetIndex(3, t);
84 requestedregion.SetSize(3, 1);
85 SetRequestedRegion(&requestedregion);
86 GetSource()->Update();
88 grid = m_GridSeries[t];
100 mitkThrow() <<
"Data object used to graft surface is not a mitk::Surface.";
102 this->CopyInformation(data);
103 m_GridSeries.clear();
105 for (
unsigned int i = 0; i < grid->
m_GridSeries.size(); ++i)
108 m_GridSeries.back()->DeepCopy(const_cast<mitk::UnstructuredGrid *>(grid)->GetVtkUnstructuredGrid(i));
119 m_LargestPossibleRegion(other.m_LargestPossibleRegion),
120 m_CalculateBoundingBox(other.m_CalculateBoundingBox)
141 if (this->GetSource())
143 this->GetSource()->UpdateOutputInformation();
145 if ((m_CalculateBoundingBox) && (m_GridSeries.size() > 0))
146 CalculateBoundingBox();
148 GetTimeGeometry()->Update();
158 if (timeGeometry->CountTimeSteps() != m_GridSeries.size())
160 itkExceptionMacro(<<
"timeGeometry->CountTimeSteps() != m_GridSeries.size() -- use Initialize(timeSteps) with "
161 "correct number of timeSteps!");
168 for (
unsigned int i = 0; i < m_GridSeries.size(); ++i)
170 vtkUnstructuredGrid *grid = m_GridSeries[i];
171 double bounds[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
172 if ((grid !=
nullptr) && (grid->GetNumberOfCells() > 0))
175 grid->ComputeBounds();
176 grid->GetBounds(bounds);
179 assert(g3d.IsNotNull());
180 g3d->SetFloatBounds(bounds);
185 itkDebugMacro(<<
"boundingbox min: " << bb->GetMinimum());
186 itkDebugMacro(<<
"boundingbox max: " << bb->GetMaximum());
187 m_CalculateBoundingBox =
false;
192 m_RequestedRegion = GetLargestPossibleRegion();
197 RegionType::IndexValueType end = m_RequestedRegion.GetIndex(3) + m_RequestedRegion.GetSize(3);
199 if (((RegionType::IndexValueType)m_GridSeries.size()) < end)
202 for (RegionType::IndexValueType t = m_RequestedRegion.GetIndex(3); t < end; ++t)
203 if (m_GridSeries[t] ==
nullptr)
211 if ((m_RequestedRegion.GetIndex(3) >= 0) &&
212 (m_RequestedRegion.GetIndex(3) + m_RequestedRegion.GetSize(3) <= m_GridSeries.size()))
231 itkExceptionMacro(<<
"mitk::UnstructuredGrid::SetRequestedRegion(DataObject*) cannot cast " <<
typeid(data).name()
239 if (region !=
nullptr)
241 m_RequestedRegion = *region;
246 itkExceptionMacro(<<
"mitk::UnstructuredGrid::SetRequestedRegion(UnstructuredGrid::RegionType*) cannot cast "
247 <<
typeid(region).name()
255 Superclass::CopyInformation(data);
260 if (GetSource().IsNull())
262 for (
auto it = m_GridSeries.begin(); it != m_GridSeries.end(); ++it)
virtual void ClearData() override
reset to non-initialized state, release memory
bool m_CalculateBoundingBox
itk::BoundingBox< unsigned long, 3, ScalarType > BoundingBox
Standard 3D-BoundingBox typedef.
itk::SmartPointer< Self > Pointer
virtual void CopyInformation(const itk::DataObject *data) override
Base of all data objects.
BoundingBox * GetBoundingBoxInWorld() const
Returns a bounding box that covers all time steps.
static void Update(vtkPolyData *)
virtual void SetRequestedRegion(const itk::DataObject *data) override
Set the requested region from this data object to match the requested region of the data object passe...
void CalculateBoundingBox()
virtual void Update() override
VTKUnstructuredGridSeries m_GridSeries
itk::ImageRegion< 5 > RegionType
virtual bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
virtual void Expand(unsigned int timeSteps=1) override
Expands the TimeGeometry to a number of TimeSteps.
virtual void SetVtkUnstructuredGrid(vtkUnstructuredGrid *grid, unsigned int t=0)
virtual vtkUnstructuredGrid * GetVtkUnstructuredGrid(unsigned int t=0)
virtual void Graft(const DataObject *data) override
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
virtual void InitializeEmpty() override
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least creat...
virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const =0
Returns the geometry which corresponds to the given time step.
Class for storing unstructured grids (vtkUnstructuredGrid)
void Update()
Updates the geometry.
virtual void UpdateOutputInformation() override
virtual const RegionType & GetRequestedRegion() const
virtual void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
virtual ~UnstructuredGrid()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.