18 #ifndef itkSpatialObject_h
19 #define itkSpatialObject_h
55 template<
unsigned int VDimension >
58 template<
unsigned int VDimension = 3 >
66 itkStaticConstMacro(MaximumDepth,
unsigned int, 9999999);
123 virtual bool HasParent()
const;
126 virtual const char *
GetTypeName(
void)
const {
return m_TypeName.c_str(); }
131 itkStaticConstMacro(ObjectDimension,
unsigned int, VDimension);
149 void SetObjectToWorldTransform(TransformType *transform);
150 itkGetModifiableObjectMacro(ObjectToWorldTransform, TransformType);
153 itkGetModifiableObjectMacro(IndexToWorldTransform, TransformType);
158 void ComputeObjectToWorldTransform();
161 void ComputeObjectToParentTransform();
170 virtual bool ValueAt(
const PointType & point,
double & value,
171 unsigned int depth = 0,
172 char *name = ITK_NULLPTR)
const;
180 virtual bool IsEvaluableAt(
const PointType & point,
181 unsigned int depth = 0,
182 char *name = ITK_NULLPTR)
const;
185 virtual bool IsInside(
const PointType & point,
186 unsigned int depth = 0,
187 char *name = ITK_NULLPTR)
const;
195 return this->IsInside(point);
199 virtual void DerivativeAt(
const PointType & point,
200 short unsigned int order,
201 OutputVectorType & value,
202 unsigned int depth = 0,
203 char *name = ITK_NULLPTR);
213 return Superclass::GetMTime();
222 virtual void SetLargestPossibleRegion(
const RegionType & region);
231 {
return m_LargestPossibleRegion; }
236 virtual void SetBufferedRegion(
const RegionType & region);
242 {
return m_BufferedRegion; }
248 virtual void SetRequestedRegion(
const RegionType & region);
254 virtual void SetRequestedRegion(
const DataObject *data) ITK_OVERRIDE;
261 {
return m_RequestedRegion; }
286 for (
int i = VDimension - 1; i > 0; i-- )
288 offset += ( ind[i] - bufferedRegionIndex[i] ) * m_OffsetTable[i];
290 offset += ( ind[0] - bufferedRegionIndex[0] );
303 for (
int i = VDimension - 1; i > 0; i-- )
305 index[i] =
static_cast< IndexValueType >( offset / m_OffsetTable[i] );
306 offset -= ( index[i] * m_OffsetTable[i] );
307 index[i] += bufferedRegionIndex[i];
309 index[0] = bufferedRegionIndex[0] +
static_cast< IndexValueType >( offset );
323 virtual void CopyInformation(
const DataObject *data) ITK_OVERRIDE;
332 virtual void UpdateOutputInformation() ITK_OVERRIDE;
337 virtual
void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE;
348 virtual
bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE;
358 virtual
bool VerifyRequestedRegion() ITK_OVERRIDE;
361 PropertyType * GetProperty();
366 void SetProperty(PropertyType *property);
369 itkGetConstReferenceMacro(Id,
int);
370 itkSetMacro(Id,
int);
374 itkSetMacro(ParentId,
int);
375 itkGetConstReferenceMacro(ParentId,
int);
379 virtual void Update(
void) ITK_OVERRIDE;
382 itkSetObjectMacro(
TreeNode, TreeNodeType)
385 itkGetModifiableObjectMacro(TreeNode, TreeNodeType);
390 void SetSpacing(const
double spacing[itkGetStaticConstMacro(ObjectDimension)])
392 m_AffineGeometryFrame->GetModifiableIndexToObjectTransform()->SetScale(spacing);
399 return this->GetIndexToObjectTransform()->GetScale();
407 const TransformType * GetIndexToObjectTransform()
const;
411 return m_AffineGeometryFrame->GetModifiableIndexToObjectTransform();
415 return m_AffineGeometryFrame->GetModifiableIndexToObjectTransform();
422 void SetObjectToParentTransform(TransformType *transform);
424 TransformType * GetObjectToParentTransform();
426 const TransformType * GetObjectToParentTransform()
const;
431 TransformType * GetObjectToNodeTransform();
433 const TransformType * GetObjectToNodeTransform()
const;
439 void AddSpatialObject(Self *pointer);
445 void RemoveSpatialObject(Self *
object);
448 virtual const Self * GetParent()
const;
451 virtual Self * GetParent();
458 virtual ChildrenListType * GetChildren(
unsigned int depth = 0,
459 char *name = ITK_NULLPTR)
const;
462 unsigned int GetNumberOfChildren(
unsigned int depth = 0,
463 char *name = ITK_NULLPTR)
const;
466 void SetChildren(ChildrenListType & children);
470 virtual void Clear();
494 virtual bool ComputeBoundingBox()
const;
498 std::cerr <<
"SpatialObject::ComputeLocalBoundingBox Not Implemented!"
505 virtual BoundingBoxType * GetBoundingBox()
const;
508 itkSetMacro(BoundingBoxChildrenDepth,
unsigned int);
509 itkGetConstReferenceMacro(BoundingBoxChildrenDepth,
unsigned int);
514 itkSetMacro(BoundingBoxChildrenName, std::string);
515 itkGetConstReferenceMacro(BoundingBoxChildrenName, std::string);
520 void SetParent(Self *parent);
523 void SetNodeToParentNodeTransform(TransformType *transform);
525 TransformType * GetNodeToParentNodeTransform();
527 const TransformType * GetNodeToParentNodeTransform()
const;
531 itkSetMacro(DefaultInsideValue,
double);
532 itkGetConstMacro(DefaultInsideValue,
double);
537 itkSetMacro(DefaultOutsideValue,
double);
538 itkGetConstMacro(DefaultOutsideValue,
double);
543 virtual std::string GetSpatialObjectTypeAsString()
const;
553 virtual void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
559 void ComputeOffsetTable();
561 itkSetMacro(Dimension,
unsigned int);
562 itkGetConstReferenceMacro(Dimension,
unsigned int)
563 itkSetMacro(TypeName, std::string);
564 itkGetModifiableObjectMacro(Bounds, BoundingBoxType);
565 itkGetModifiableObjectMacro(InternalInverseTransform, TransformType);
573 bool SetInternalInverseTransformToWorldToIndexTransform()
const;
627 #if !defined( ITK_WRAPPING_PARSER )
628 #ifndef ITK_MANUAL_INSTANTIATION
629 #include "itkSpatialObject.hxx"
633 #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
double m_DefaultInsideValue
virtual bool ComputeLocalBoundingBox() const
TransformPointer m_InternalInverseTransform
CovariantVector< double, VDimension > OutputVectorType
virtual const RegionType & GetLargestPossibleRegion() const
SmartPointer< Self > Pointer
VectorContainer< IdentifierType, PointType > VectorContainerType
TransformType * GetIndexToObjectTransform(void)
AffineGeometryFramePointer m_AffineGeometryFrame
RegionType m_RequestedRegion
AffineGeometryFrame< double, VDimension > AffineGeometryFrameType
TransformType::Pointer TransformPointer
const TransformType * TransformConstPointer
RegionType m_LargestPossibleRegion
IndexType ComputeIndex(OffsetValueType offset) const
PropertyType::Pointer PropertyPointer
unsigned int m_BoundingBoxChildrenDepth
TransformPointer m_ObjectToParentTransform
OutputVectorType * OutputVectorPointer
const OffsetValueType * GetOffsetTable() const
VectorType * VectorPointer
ModifiedTimeType m_BoundsMTime
A templated class holding a n-Dimensional vector.
ChildrenListType m_InternalChildrenList
Size< VDimension > SizeType
std::string m_BoundingBoxChildrenName
Implementation of the composite pattern.
SpatialObjectTreeNode< VDimension > TreeNodeType
PropertyPointer m_Property
std::list< Pointer > ChildrenListType
Vector< ScalarType, VDimension > VectorType
BoundingBoxPointer m_Bounds
RegionType m_BufferedRegion
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
TreeNodeType::Pointer m_TreeNode
unsigned int GetObjectDimension(void) const
double m_DefaultOutsideValue
OffsetValueType ComputeOffset(const IndexType &ind) const
Describes the geometry of a data object.
TransformPointer m_ObjectToWorldTransform
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.
TransformPointer m_IndexToWorldTransform