diff --git a/Core/Code/DataManagement/mitkSurface.cpp b/Core/Code/DataManagement/mitkSurface.cpp index aef0f49b77..584fc115f2 100644 --- a/Core/Code/DataManagement/mitkSurface.cpp +++ b/Core/Code/DataManagement/mitkSurface.cpp @@ -1,382 +1,385 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - #include "mitkSurface.h" #include "mitkInteractionConst.h" #include "mitkSurfaceOperation.h" +#include #include -#include "vtkSmartPointer.h" +static vtkPolyData* DeepCopy(vtkPolyData* other) +{ + if (other == NULL) + return NULL; + + vtkPolyData* copy = vtkPolyData::New(); + copy->DeepCopy(other); + + return copy; +} + +static void Delete(vtkPolyData* polyData) +{ + if (polyData != NULL) + polyData->Delete(); +} -mitk::Surface::Surface() : -m_CalculateBoundingBox( false ) +static void Update(vtkPolyData* polyData) +{ + if (polyData != NULL) + polyData->Update(); +} + +mitk::Surface::Surface() + : m_CalculateBoundingBox(false) { this->InitializeEmpty(); } -mitk::Surface::Surface(const mitk::Surface& other) : BaseData(other), -m_LargestPossibleRegion(other.m_LargestPossibleRegion), -m_RequestedRegion(other.m_RequestedRegion), -m_CalculateBoundingBox(other.m_CalculateBoundingBox) +mitk::Surface::Surface(const mitk::Surface& other) + : BaseData(other), + m_LargestPossibleRegion(other.m_LargestPossibleRegion), + m_RequestedRegion(other.m_RequestedRegion), + m_CalculateBoundingBox(other.m_CalculateBoundingBox) { - if(other.m_PolyDataSeries.at(0) != NULL) + if(!other.m_PolyDatas.empty()) { - this->m_PolyDataSeries = std::vector(); - for ( VTKPolyDataSeries::const_iterator it = other.m_PolyDataSeries.begin(); it != other.m_PolyDataSeries.end(); ++it ) - { - vtkPolyData* poly = vtkPolyData::New(); - poly->DeepCopy(*it); - m_PolyDataSeries.push_back(poly); - //poly->Delete(); - } + m_PolyDatas.resize(other.m_PolyDatas.size()); + std::transform(other.m_PolyDatas.begin(), other.m_PolyDatas.end(), m_PolyDatas.begin(), DeepCopy); } else { this->InitializeEmpty(); } } +void mitk::Surface::Swap(mitk::Surface& other) +{ + std::swap(m_PolyDatas, other.m_PolyDatas); + std::swap(m_LargestPossibleRegion, other.m_LargestPossibleRegion); + std::swap(m_RequestedRegion, other.m_RequestedRegion); + std::swap(m_CalculateBoundingBox, other.m_CalculateBoundingBox); +} + +mitk::Surface& mitk::Surface::operator=(Surface other) +{ + this->Swap(other); + return *this; +} + mitk::Surface::~Surface() { this->ClearData(); } void mitk::Surface::ClearData() { - for ( VTKPolyDataSeries::iterator it = m_PolyDataSeries.begin(); it != m_PolyDataSeries.end(); ++it ) - { - if ( ( *it ) != NULL ) - ( *it )->Delete(); - } - m_PolyDataSeries.clear(); + using ::Delete; + + std::for_each(m_PolyDatas.begin(), m_PolyDatas.end(), Delete); + m_PolyDatas.clear(); Superclass::ClearData(); } +const mitk::Surface::RegionType& mitk::Surface::GetLargestPossibleRegion() const +{ + m_LargestPossibleRegion.SetIndex(3, 0); + m_LargestPossibleRegion.SetSize(3, GetTimeSlicedGeometry()->GetTimeSteps()); + + return m_LargestPossibleRegion; +} + +const mitk::Surface::RegionType& mitk::Surface::GetRequestedRegion() const +{ + return m_RequestedRegion; +} + void mitk::Surface::InitializeEmpty() { - vtkPolyData* pdnull = NULL; - m_PolyDataSeries.resize( 1, pdnull ); - Superclass::InitializeTimeSlicedGeometry(1); + if (!m_PolyDatas.empty()) + this->ClearData(); + + Superclass::InitializeTimeSlicedGeometry(); + m_PolyDatas.push_back(NULL); m_Initialized = true; } -void mitk::Surface::SetVtkPolyData( vtkPolyData* polydata, unsigned int t ) +void mitk::Surface::SetVtkPolyData(vtkPolyData* polyData, unsigned int t) { - // Adapt the size of the data vector if necessary - this->Expand( t+1 ); + this->Expand(t + 1); - if(m_PolyDataSeries[ t ] != NULL) + if (m_PolyDatas[t] != NULL) { - if ( m_PolyDataSeries[ t ] == polydata ) + if (m_PolyDatas[t] == polyData) return; - // we do not need the reference on the object any longer - m_PolyDataSeries[ t ]->Delete(); - } - m_PolyDataSeries[ t ] = polydata; - // call m_VtkPolyData->Register(NULL) to tell - // the reference counting that we want to keep a - // reference on the object - if(m_PolyDataSeries[ t ] != NULL) - { - m_PolyDataSeries[ t ]->Register( NULL ); + + m_PolyDatas[t]->Delete(); } - this->Modified(); + + m_PolyDatas[t] = polyData; + + if(polyData != NULL) + polyData->Register(NULL); + m_CalculateBoundingBox = true; + + this->Modified(); this->UpdateOutputInformation(); } bool mitk::Surface::IsEmptyTimeStep(unsigned int t) const { if(!IsInitialized()) return false; - vtkPolyData* polydata = const_cast(this)->GetVtkPolyData(t); - return - (polydata == NULL) || - ( - (polydata->GetNumberOfVerts() <= 0) && - (polydata->GetNumberOfPolys() <= 0) && - (polydata->GetNumberOfStrips() <= 0) && - (polydata->GetNumberOfLines() <= 0) - ); + + vtkPolyData* polyData = const_cast(this)->GetVtkPolyData(t); + + return polyData == NULL || + polyData->GetNumberOfLines() == 0 && + polyData->GetNumberOfPolys() == 0 && + polyData->GetNumberOfStrips() == 0 && + polyData->GetNumberOfVerts() == 0; } -vtkPolyData* mitk::Surface::GetVtkPolyData( unsigned int t ) +vtkPolyData* mitk::Surface::GetVtkPolyData(unsigned int t) { - - if ( t < m_PolyDataSeries.size() ) + if (t < m_PolyDatas.size()) { - vtkPolyData* polydata = m_PolyDataSeries[ t ]; - if((polydata==NULL) && (GetSource().GetPointer()!=NULL)) + if(m_PolyDatas[t] == NULL && this->GetSource().IsNotNull()) { - RegionType requestedregion; - requestedregion.SetIndex(3, t); - requestedregion.SetSize(3, 1); - SetRequestedRegion(&requestedregion); - GetSource()->Update(); + RegionType requestedRegion; + requestedRegion.SetIndex(3, t); + requestedRegion.SetSize(3, 1); + + this->SetRequestedRegion(&requestedRegion); + this->GetSource()->Update(); } - polydata = m_PolyDataSeries[ t ]; - return polydata; + + return m_PolyDatas[t]; } - else - return NULL; + + return NULL; } void mitk::Surface::UpdateOutputInformation() { - if ( this->GetSource() ) - { + if (this->GetSource().IsNotNull()) this->GetSource()->UpdateOutputInformation(); - } - if ( ( m_CalculateBoundingBox ) && ( m_PolyDataSeries.size() > 0 ) ) - CalculateBoundingBox(); + + if (m_CalculateBoundingBox == true && !m_PolyDatas.empty()) + this->CalculateBoundingBox(); else - GetTimeSlicedGeometry()->UpdateInformation(); + this->GetTimeSlicedGeometry()->UpdateInformation(); } void mitk::Surface::CalculateBoundingBox() { - // - // first make sure, that the associated time sliced geometry has - // the same number of geometry 3d's as vtkPolyDatas are present - // - mitk::TimeSlicedGeometry* timeGeometry = GetTimeSlicedGeometry(); - if ( timeGeometry->GetTimeSteps() != m_PolyDataSeries.size() ) - { - itkExceptionMacro(<<"timeGeometry->GetTimeSteps() != m_PolyDataSeries.size() -- use Initialize(timeSteps) with correct number of timeSteps!"); - } + mitk::TimeSlicedGeometry* timeSlicedGeometry = this->GetTimeSlicedGeometry(); - // - // Iterate over the vtkPolyDatas and update the Geometry - // information of each of the items. - // - for ( unsigned int i = 0 ; i < m_PolyDataSeries.size() ; ++i ) + if (timeSlicedGeometry->GetTimeSteps() != m_PolyDatas.size()) + mitkThrow() << "Number of geometry time steps is inconsistent with number of poly data pointers."; + + for (unsigned int i = 0; i < m_PolyDatas.size(); ++i) { - vtkPolyData* polyData = m_PolyDataSeries[ i ]; - vtkFloatingPointType bounds[ ] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - if ( ( polyData != NULL ) && ( polyData->GetNumberOfPoints() > 0 ) ) + vtkPolyData* polyData = m_PolyDatas[i]; + vtkFloatingPointType bounds[6] = {0}; + + if (polyData != NULL && polyData->GetNumberOfPoints() > 0) { polyData->Update(); polyData->ComputeBounds(); - polyData->GetBounds( bounds ); + polyData->GetBounds(bounds); } - mitk::Geometry3D::Pointer g3d = timeGeometry->GetGeometry3D( i ); - assert( g3d.IsNotNull() ); - g3d->SetFloatBounds( bounds ); + + mitk::Geometry3D::Pointer geometry = timeSlicedGeometry->GetGeometry3D(i); + + if (geometry.IsNull()) + mitkThrow() << "Time-sliced geometry is invalid (equals NULL)."; + + geometry->SetFloatBounds(bounds); } - timeGeometry->UpdateInformation(); - mitk::BoundingBox::Pointer bb = const_cast( timeGeometry->GetBoundingBox() ); - itkDebugMacro( << "boundingbox min: "<< bb->GetMinimum()); - itkDebugMacro( << "boundingbox max: "<< bb->GetMaximum()); + timeSlicedGeometry->UpdateInformation(); m_CalculateBoundingBox = false; } void mitk::Surface::SetRequestedRegionToLargestPossibleRegion() { m_RequestedRegion = GetLargestPossibleRegion(); } bool mitk::Surface::RequestedRegionIsOutsideOfTheBufferedRegion() { - RegionType::IndexValueType end = m_RequestedRegion.GetIndex(3)+m_RequestedRegion.GetSize(3); + RegionType::IndexValueType end = m_RequestedRegion.GetIndex(3) + m_RequestedRegion.GetSize(3); - if(((RegionType::IndexValueType)m_PolyDataSeries.size())(m_PolyDatas.size()) < end) return true; - for( RegionType::IndexValueType t=m_RequestedRegion.GetIndex(3); t=0) && - (m_RequestedRegion.GetIndex(3)+m_RequestedRegion.GetSize(3)<=m_PolyDataSeries.size()) ) + if(m_RequestedRegion.GetIndex(3) >= 0 && m_RequestedRegion.GetIndex(3) + m_RequestedRegion.GetSize(3) <= m_PolyDatas.size()) return true; return false; } -void mitk::Surface::SetRequestedRegion( itk::DataObject *data ) +void mitk::Surface::SetRequestedRegion(itk::DataObject* data) { - mitk::Surface *surfaceData; + mitk::Surface* surface = dynamic_cast(data); - surfaceData = dynamic_cast(data); - - if (surfaceData) - { - m_RequestedRegion = surfaceData->GetRequestedRegion(); - } + if (surface != NULL) + m_RequestedRegion = surface->GetRequestedRegion(); else - { - // pointer could not be cast back down - itkExceptionMacro( << "mitk::Surface::SetRequestedRegion(DataObject*) cannot cast " << typeid(data).name() << " to " << typeid(Surface*).name() ); - } + mitkThrow() << "Data object used to get requested region is not a mitk::Surface."; } -void mitk::Surface::SetRequestedRegion(Surface::RegionType *region) //by arin +void mitk::Surface::SetRequestedRegion(Surface::RegionType* region) { - if(region!=NULL) - { - m_RequestedRegion = *region; - } - else - { - // pointer could not be cast back down - itkExceptionMacro( << "mitk::Surface::SetRequestedRegion(Surface::RegionType*) cannot cast " << typeid(region).name() << " to " << typeid(Surface*).name() ); - } + if (region == NULL) + mitkThrow() << "Requested region is invalid (equals NULL)"; + + m_RequestedRegion = *region; } -void mitk::Surface::CopyInformation( const itk::DataObject * data) +void mitk::Surface::CopyInformation(const itk::DataObject* data) { - Superclass::CopyInformation( data ); + Superclass::CopyInformation(data); - const mitk::Surface* surfaceData; + const mitk::Surface* surface = dynamic_cast(data); - surfaceData = dynamic_cast( data ); + if (surface == NULL) + mitkThrow() << "Data object used to get largest possible region is not a mitk::Surface."; - if ( surfaceData ) - { - m_LargestPossibleRegion = surfaceData->GetLargestPossibleRegion(); - } - else - { - // pointer could not be cast back down - itkExceptionMacro( << "mitk::Surface::CopyInformation(const DataObject *data) cannot cast " << typeid(data).name() << " to " << typeid(surfaceData).name() ); - } + m_LargestPossibleRegion = surface->GetLargestPossibleRegion(); } void mitk::Surface::Update() { - if ( GetSource().IsNull() ) - { - for ( VTKPolyDataSeries::iterator it = m_PolyDataSeries.begin() ; it != m_PolyDataSeries.end() ; ++it ) - { - if ( ( *it ) != NULL ) - ( *it )->Update(); - } - } + using ::Update; + + if (this->GetSource().IsNull()) + std::for_each(m_PolyDatas.begin(), m_PolyDatas.end(), Update); + Superclass::Update(); } -void mitk::Surface::Expand( unsigned int timeSteps ) +void mitk::Surface::Expand(unsigned int timeSteps) { - // 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_PolyDataSeries.size() ) + if (timeSteps > m_PolyDatas.size()) { - Superclass::Expand( timeSteps ); - vtkPolyData* pdnull = NULL; - m_PolyDataSeries.resize( timeSteps, pdnull ); + Superclass::Expand(timeSteps); + + m_PolyDatas.resize(timeSteps); m_CalculateBoundingBox = true; } } -void mitk::Surface::ExecuteOperation(Operation *operation) +void mitk::Surface::ExecuteOperation(Operation* operation) { - switch ( operation->GetOperationType() ) + switch (operation->GetOperationType()) { - case OpSURFACECHANGED: + case OpSURFACECHANGED: + { + mitk::SurfaceOperation* surfaceOperation = dynamic_cast(operation); - mitk::SurfaceOperation* surfOp = dynamic_cast(operation); - if( ! surfOp ) break; + if(surfaceOperation == NULL) + break; - unsigned int time = surfOp->GetTimeStep(); + unsigned int timeStep = surfaceOperation->GetTimeStep(); - if(m_PolyDataSeries[ time ] != NULL) - { - vtkPolyData* updatePoly = surfOp->GetVtkPolyData(); - if( updatePoly ){ - this->SetVtkPolyData( updatePoly, time ); - this->CalculateBoundingBox(); + if(m_PolyDatas[timeStep] != NULL) + { + vtkPolyData* updatedPolyData = surfaceOperation->GetVtkPolyData(); + + if(updatedPolyData != NULL) + { + this->SetVtkPolyData(updatedPolyData, timeStep); + this->CalculateBoundingBox(); + this->Modified(); + } } + + break; } - break; + + default: + return; } - this->Modified(); } unsigned int mitk::Surface::GetSizeOfPolyDataSeries() const { - return m_PolyDataSeries.size(); + return m_PolyDatas.size(); } -void mitk::Surface::Graft( const DataObject* data ) +void mitk::Surface::Graft(const DataObject* data) { - const Self* surface; - try - { - surface = dynamic_cast( data ); - } - catch(...) - { - itkExceptionMacro( << "mitk::Surface::Graft cannot cast " - << typeid(data).name() << " to " - << typeid(const Self *).name() ); - return; - } + const Surface* surface = dynamic_cast(data); + + if(surface == NULL) + mitkThrow() << "Data object used to graft surface is not a mitk::Surface."; + + this->CopyInformation(data); + m_PolyDatas.clear(); - if(!surface) + for (unsigned int i = 0; i < surface->GetSizeOfPolyDataSeries(); ++i) { - // pointer could not be cast back down - itkExceptionMacro( << "mitk::Surface::Graft cannot cast " - << typeid(data).name() << " to " - << typeid(const Self *).name() ); - return; + m_PolyDatas.push_back(vtkPolyData::New()); + m_PolyDatas.back()->DeepCopy(const_cast(surface)->GetVtkPolyData(i)); } - - this->CopyInformation( data ); - //clear list of PolyData's - m_PolyDataSeries.clear(); - // do copy - for (unsigned int i=0; iGetSizeOfPolyDataSeries(); i++) - { - m_PolyDataSeries.push_back(vtkPolyData::New()); - m_PolyDataSeries.back()->DeepCopy( const_cast(surface)->GetVtkPolyData( i ) ); - //CopyStructure( const_cast(surface)->GetVtkPolyData( i ) ); - } } -void mitk::Surface::PrintSelf( std::ostream& os, itk::Indent indent ) const +void mitk::Surface::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); - os << indent << "\nNumber PolyDatas: " << m_PolyDataSeries.size() << "\n"; + os << indent << "\nNumber PolyDatas: " << m_PolyDatas.size() << "\n"; + unsigned int count = 0; - for (VTKPolyDataSeries::const_iterator it = m_PolyDataSeries.begin(); it != m_PolyDataSeries.end(); ++it) + + for (std::vector::const_iterator it = m_PolyDatas.begin(); it != m_PolyDatas.end(); ++it) { - vtkPolyData* pd = *it; - if(pd != NULL) + os << "\n"; + + if(*it != NULL) { - os << "\n"; - os << indent << "PolyData at time step " << count << ". \n"; - os << indent << "Number of cells " << pd->GetNumberOfCells() << ": \n"; - os << indent << "Number of points " << pd->GetNumberOfPoints() << ": \n\n"; - os << indent << "VTKPolyData : \n"; - pd->Print(os); + os << indent << "PolyData at time step " << count << ":\n"; + os << indent << "Number of cells: " << (*it)->GetNumberOfCells() << "\n"; + os << indent << "Number of points: " << (*it)->GetNumberOfPoints() << "\n\n"; + os << indent << "VTKPolyData:\n"; + + (*it)->Print(os); } else - os << indent << "\nEmpty PolyData at time step " << count << ".\n"; + { + os << indent << "Empty PolyData at time step " << count << "\n"; + } - count++; + ++count; } } diff --git a/Core/Code/DataManagement/mitkSurface.h b/Core/Code/DataManagement/mitkSurface.h index cce81fa05c..00553d52f2 100644 --- a/Core/Code/DataManagement/mitkSurface.h +++ b/Core/Code/DataManagement/mitkSurface.h @@ -1,115 +1,79 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ - -#ifndef MITKSURFACEDATA_H_HEADER_INCLUDED -#define MITKSURFACEDATA_H_HEADER_INCLUDED +#ifndef mitkSurface_h +#define mitkSurface_h #include "mitkBaseData.h" #include "itkImageRegion.h" class vtkPolyData; -namespace mitk { - - //##Documentation - //## @brief Class for storing surfaces (vtkPolyData) - //## @ingroup Data +namespace mitk +{ + /** + * \brief Class for storing surfaces (vtkPolyData). + * \ingroup Data + */ class MITK_CORE_EXPORT Surface : public BaseData { - protected: - public: - // not yet the best chioce of a region-type for surfaces, but it works for the time being - typedef itk::ImageRegion< 5 > RegionType; + typedef itk::ImageRegion<5> RegionType; mitkClassMacro(Surface, BaseData); itkNewMacro(Self); mitkCloneMacro(Surface); - virtual void SetVtkPolyData(vtkPolyData* polydata, unsigned int t = 0); - + void CalculateBoundingBox(); + virtual void CopyInformation(const itk::DataObject *data); + virtual void ExecuteOperation(Operation *operation); + virtual void Expand( unsigned int timeSteps = 1 ); + const RegionType& GetLargestPossibleRegion() const; + virtual const RegionType& GetRequestedRegion() const; + unsigned int GetSizeOfPolyDataSeries() const; virtual vtkPolyData* GetVtkPolyData(unsigned int t = 0); - - virtual void UpdateOutputInformation(); - - virtual void SetRequestedRegionToLargestPossibleRegion(); - + virtual void Graft( const DataObject* data ); + virtual bool IsEmptyTimeStep(unsigned int t) const; + virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); - - virtual bool VerifyRequestedRegion(); - virtual void SetRequestedRegion(itk::DataObject *data); - virtual void SetRequestedRegion(Surface::RegionType *region); - - virtual void CopyInformation(const itk::DataObject *data); - - virtual bool IsEmptyTimeStep(unsigned int t) const; - - unsigned int GetSizeOfPolyDataSeries() const; - + virtual void SetRequestedRegionToLargestPossibleRegion(); + virtual void SetVtkPolyData(vtkPolyData* polydata, unsigned int t = 0); + virtual void Swap(Surface& other); virtual void Update(); - - virtual void Expand( unsigned int timeSteps = 1 ); - - virtual void Graft( const DataObject* data ); - - const RegionType& GetLargestPossibleRegion() const - { - m_LargestPossibleRegion.SetIndex(3, 0); - m_LargestPossibleRegion.SetSize(3, GetTimeSlicedGeometry()->GetTimeSteps()); - return m_LargestPossibleRegion; - } - - //##Documentation - //## 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). - virtual const RegionType& GetRequestedRegion() const - { - return m_RequestedRegion; - } - - void CalculateBoundingBox(); - - virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; - - virtual void ExecuteOperation(Operation *operation); + virtual void UpdateOutputInformation(); + virtual bool VerifyRequestedRegion(); protected: - - typedef std::vector< vtkPolyData* > VTKPolyDataSeries; - Surface(); - Surface(const Surface& other); - virtual ~Surface(); - virtual void ClearData(); + Surface(const Surface& other); + Surface& operator=(Surface other); + virtual void ClearData(); virtual void InitializeEmpty(); - //member variables - VTKPolyDataSeries m_PolyDataSeries; /// variable holds the poly datas of the surface - mutable RegionType m_LargestPossibleRegion; /// variable holds the largest possible region the surface is contained in + private: + std::vector m_PolyDatas; + mutable RegionType m_LargestPossibleRegion; RegionType m_RequestedRegion; - bool m_CalculateBoundingBox; /// flag to calculate the bounding box + bool m_CalculateBoundingBox; }; +} -} // namespace mitk - -#endif /* MITKSURFACEDATA_H_HEADER_INCLUDED */ +#endif diff --git a/Modules/MitkExt/DataManagement/mitkBoundingObject.h b/Modules/MitkExt/DataManagement/mitkBoundingObject.h index 7a83e229cd..cf1642f39f 100644 --- a/Modules/MitkExt/DataManagement/mitkBoundingObject.h +++ b/Modules/MitkExt/DataManagement/mitkBoundingObject.h @@ -1,65 +1,69 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef BOUNDINGOBJECT_H_HEADER_INCLUDED #define BOUNDINGOBJECT_H_HEADER_INCLUDED #include #include "MitkExtExports.h" namespace mitk { //##Documentation //## @brief superclass of all bounding objects (cylinder, cuboid,...) //## //## Manages generic functions and provides an interface for IsInside() //## calculates a generic bounding box //## @ingroup Data class MitkExt_EXPORT BoundingObject : public mitk::Surface //BaseData { public: mitkClassMacro(BoundingObject, mitk::Surface); virtual bool IsInside(const mitk::Point3D& p) const=0; virtual mitk::ScalarType GetVolume(); itkGetMacro(Positive, bool); itkSetMacro(Positive, bool); itkBooleanMacro(Positive); //##Documentation //## @brief Sets the Geometry3D of the bounding object to fit the given //## geometry. //## //## The fit is done once, so if the given geometry changes it will //## \em not effect the bounding object. virtual void FitGeometry(Geometry3D* aGeometry3D); protected: BoundingObject(); virtual ~BoundingObject(); bool WriteXMLData( XMLWriter& xmlWriter ); //##Documentation //## \brief If \a true, the Boundingobject describes a positive volume, //## if \a false a negative volume. //## bool m_Positive; + +private: + BoundingObject(const BoundingObject&); + BoundingObject& operator=(const BoundingObject&); }; } #endif /* BOUNDINGOBJECT_H_HEADER_INCLUDED */