18 #ifndef itkSpatialObject_h
19 #define itkSpatialObject_h
56 template<
unsigned int VDimension >
59 template<
unsigned int VDimension = 3 >
67 itkStaticConstMacro(MaximumDepth,
unsigned int, 9999999);
124 virtual bool HasParent()
const;
127 virtual const char *
GetTypeName(
void)
const {
return m_TypeName.c_str(); }
132 itkStaticConstMacro(ObjectDimension,
unsigned int, VDimension);
150 void SetObjectToWorldTransform(TransformType *transform);
151 itkGetModifiableObjectMacro(ObjectToWorldTransform, TransformType);
154 itkGetModifiableObjectMacro(IndexToWorldTransform, TransformType);
159 void ComputeObjectToWorldTransform();
162 void ComputeObjectToParentTransform();
171 virtual bool ValueAt(
const PointType & point,
double & value,
172 unsigned int depth = 0,
173 char *name = ITK_NULLPTR)
const;
181 virtual bool IsEvaluableAt(
const PointType & point,
182 unsigned int depth = 0,
183 char *name = ITK_NULLPTR)
const;
186 virtual bool IsInside(
const PointType & point,
187 unsigned int depth = 0,
188 char *name = ITK_NULLPTR)
const;
196 return this->IsInside(point);
200 virtual void DerivativeAt(
const PointType & point,
201 short unsigned int order,
202 OutputVectorType & value,
203 unsigned int depth = 0,
204 char *name = ITK_NULLPTR);
214 return Superclass::GetMTime();
223 virtual void SetLargestPossibleRegion(
const RegionType & region);
232 {
return m_LargestPossibleRegion; }
237 virtual void SetBufferedRegion(
const RegionType & region);
243 {
return m_BufferedRegion; }
249 virtual void SetRequestedRegion(
const RegionType & region);
255 virtual void SetRequestedRegion(
const DataObject *data) ITK_OVERRIDE;
262 {
return m_RequestedRegion; }
287 for (
int i = VDimension - 1; i > 0; i-- )
289 offset += ( ind[i] - bufferedRegionIndex[i] ) * m_OffsetTable[i];
291 offset += ( ind[0] - bufferedRegionIndex[0] );
304 for (
int i = VDimension - 1; i > 0; i-- )
306 index[i] =
static_cast< IndexValueType >( offset / m_OffsetTable[i] );
307 offset -= ( index[i] * m_OffsetTable[i] );
308 index[i] += bufferedRegionIndex[i];
310 index[0] = bufferedRegionIndex[0] +
static_cast< IndexValueType >( offset );
324 virtual void CopyInformation(
const DataObject *data) ITK_OVERRIDE;
333 virtual void UpdateOutputInformation() ITK_OVERRIDE;
338 virtual
void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE;
349 virtual
bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE;
359 virtual
bool VerifyRequestedRegion() ITK_OVERRIDE;
362 PropertyType * GetProperty();
367 void SetProperty(PropertyType *property);
370 itkGetConstReferenceMacro(Id,
int);
371 itkSetMacro(Id,
int);
375 itkSetMacro(ParentId,
int);
376 itkGetConstReferenceMacro(ParentId,
int);
380 virtual void Update(
void) ITK_OVERRIDE;
383 itkSetObjectMacro(
TreeNode, TreeNodeType)
386 itkGetModifiableObjectMacro(TreeNode, TreeNodeType);
391 void SetSpacing(const
double spacing[itkGetStaticConstMacro(ObjectDimension)])
393 m_AffineGeometryFrame->GetModifiableIndexToObjectTransform()->SetScale(spacing);
400 return this->GetIndexToObjectTransform()->GetScale();
408 const TransformType * GetIndexToObjectTransform()
const;
412 return m_AffineGeometryFrame->GetModifiableIndexToObjectTransform();
416 return m_AffineGeometryFrame->GetModifiableIndexToObjectTransform();
423 void SetObjectToParentTransform(TransformType *transform);
425 TransformType * GetObjectToParentTransform();
427 const TransformType * GetObjectToParentTransform()
const;
432 itkLegacyMacro(TransformType * GetObjectToNodeTransform());
433 #if defined(ITK_LEGACY_REMOVE)
434 TransformType * GetModifiableObjectToNodeTransform();
436 const TransformType * GetObjectToNodeTransform()
const;
443 void AddSpatialObject(Self *pointer);
449 void RemoveSpatialObject(Self *
object);
452 virtual const Self * GetParent()
const;
455 virtual Self * GetParent();
462 virtual ChildrenListType * GetChildren(
unsigned int depth = 0,
463 char *name = ITK_NULLPTR)
const;
466 unsigned int GetNumberOfChildren(
unsigned int depth = 0,
467 char *name = ITK_NULLPTR)
const;
470 void SetChildren(ChildrenListType & children);
474 virtual void Clear();
498 virtual bool ComputeBoundingBox()
const;
502 std::cerr <<
"SpatialObject::ComputeLocalBoundingBox Not Implemented!"
509 virtual BoundingBoxType * GetBoundingBox()
const;
512 itkSetMacro(BoundingBoxChildrenDepth,
unsigned int);
513 itkGetConstReferenceMacro(BoundingBoxChildrenDepth,
unsigned int);
518 itkSetMacro(BoundingBoxChildrenName, std::string);
519 itkGetConstReferenceMacro(BoundingBoxChildrenName, std::string);
524 void SetParent(Self *parent);
527 void SetNodeToParentNodeTransform(TransformType *transform);
529 TransformType * GetNodeToParentNodeTransform();
531 const TransformType * GetNodeToParentNodeTransform()
const;
535 itkSetMacro(DefaultInsideValue,
double);
536 itkGetConstMacro(DefaultInsideValue,
double);
541 itkSetMacro(DefaultOutsideValue,
double);
542 itkGetConstMacro(DefaultOutsideValue,
double);
547 virtual std::string GetSpatialObjectTypeAsString()
const;
557 virtual
void PrintSelf(std::ostream & os,
Indent indent) const ITK_OVERRIDE;
563 void ComputeOffsetTable();
566 itkGetConstReferenceMacro(Dimension,
unsigned int)
567 itkSetMacro(TypeName, std::
string);
568 itkGetModifiableObjectMacro(Bounds, BoundingBoxType);
569 itkGetModifiableObjectMacro(InternalInverseTransform, TransformType);
577 bool SetInternalInverseTransformToWorldToIndexTransform() const;
591 std::
string m_TypeName;
593 unsigned int m_Dimension;
601 std::
string m_BoundingBoxChildrenName;
602 unsigned int m_BoundingBoxChildrenDepth;
624 double m_DefaultInsideValue;
627 double m_DefaultOutsideValue;
631 #if !defined( ITK_WRAPPING_PARSER )
632 #ifndef ITK_MANUAL_INSTANTIATION
633 #include "itkSpatialObject.hxx"
637 #endif // itkSpatialObject_h
unsigned int GetMaximumDepth() const
const IndexValueType * GetIndex() const
Index< VDimension > IndexType
Point< ScalarType, VDimension > PointType
bool Evaluate(const PointType &point) const
Offset< VDimension > OffsetType
Represents a node in a tree.
virtual const double * GetSpacing() const
ImageRegion< VDimension > RegionType
BoundingBox< IdentifierType, VDimension, ScalarType, VectorContainerType > BoundingBoxType
SpatialObjectProperty< float > PropertyType
SpatialObject< VDimension > Self
SmartPointer< const Self > ConstPointer
Represent the size (bounds) of a n-dimensional image.
TransformType * GetModifiableIndexToObjectTransform(void)
signed long OffsetValueType
AffineGeometryFrameType::Pointer AffineGeometryFramePointer
signed long IndexValueType
unsigned long ModifiedTimeType
virtual bool ComputeLocalBoundingBox() const
CovariantVector< double, VDimension > OutputVectorType
virtual const RegionType & GetLargestPossibleRegion() const
SmartPointer< Self > Pointer
VectorContainer< IdentifierType, PointType > VectorContainerType
TransformType * GetIndexToObjectTransform(void)
class ITK_FORWARD_EXPORT SpatialObject
AffineGeometryFrame< double, VDimension > AffineGeometryFrameType
TransformType::Pointer TransformPointer
const TransformType * TransformConstPointer
IndexType ComputeIndex(OffsetValueType offset) const
PropertyType::Pointer PropertyPointer
OutputVectorType * OutputVectorPointer
const OffsetValueType * GetOffsetTable() const
VectorType * VectorPointer
A templated class holding a n-Dimensional vector.
ImageBaseType::PointType PointType
Size< VDimension > SizeType
Implementation of the composite pattern.
SpatialObjectTreeNode< VDimension > TreeNodeType
std::list< Pointer > ChildrenListType
const unsigned int Dimension
Vector< ScalarType, VDimension > VectorType
virtual const RegionType & GetRequestedRegion() const
ChildrenListType * ChildrenListPointer
CovariantVector< ScalarType, VDimension > CovariantVectorType
virtual const RegionType & GetBufferedRegion() const
virtual const char * GetTypeName(void) const
Point< ScalarType, VDimension > InputType
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
ScalableAffineTransform< double, VDimension > TransformType
unsigned int GetObjectDimension(void) const
OffsetValueType ComputeOffset(const IndexType &ind) const
Describes the geometry of a data object.
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional covariant vector.
Base class for all data objects in ITK.
BoundingBoxType::Pointer BoundingBoxPointer
Represent and compute information about bounding boxes.