| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkCellInterface.txx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:33 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
DEF |
#ifndef _itkCellInterface_txx |
| 18 |
DEF |
#define _itkCellInterface_txx |
| 19 |
|
#include "itkCellInterface.h" |
| 20 |
|
|
| 21 |
|
namespace itk |
| 22 |
|
{ |
| 23 |
|
/** |
| 24 |
|
* Get the interpolation order of the cell. Usually linear. |
| 25 |
|
*/ |
| 26 |
|
template <typename TPixelType, typename TCellTraits> |
| 27 |
|
unsigned int |
| 28 |
|
CellInterface< TPixelType , TCellTraits > |
| 29 |
|
::GetInterpolationOrder(void) const |
| 30 |
|
{ |
| 31 |
|
return 1; |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
/** |
| 36 |
|
* Get the point id list used by the cell in a form suitable to pass to |
| 37 |
|
* SetPointIds(first) on another cell. This is equivalent to |
| 38 |
|
* PointIdsBegin() const. |
| 39 |
|
*/ |
| 40 |
|
template <typename TPixelType, typename TCellTraits> |
| 41 |
|
typename CellInterface< TPixelType , TCellTraits >::PointIdConstIterator |
| 42 |
|
CellInterface< TPixelType , TCellTraits > |
| 43 |
|
::GetPointIds(void) const |
| 44 |
|
{ |
| 45 |
|
return this->PointIdsBegin(); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
|
| 49 |
|
/** |
| 50 |
|
* Return true if the UsingCellsContainer m_UsingCells is nonempty, |
| 51 |
|
* false otherwise. The container m_UsingCells is meant to contain a |
| 52 |
|
* list of all the cells that have this one as part of their boundary. |
| 53 |
|
* Boundary data is not automatically recorded upon mesh creation. If |
| 54 |
|
* the boundary information has not been computed, this method always |
| 55 |
|
* returns false. |
| 56 |
|
*/ |
| 57 |
|
template <typename TPixelType, typename TCellTraits> |
| 58 |
|
bool |
| 59 |
|
CellInterface< TPixelType , TCellTraits > |
| 60 |
|
::IsExplicitBoundary(void) |
| 61 |
|
{ |
| 62 |
|
return !m_UsingCells.empty(); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
/** |
| 67 |
|
* Register the fact that this cell is a part of the boundary of the |
| 68 |
|
* cell \a cellId, by adding \a cellId to the UsingCellsContainer. |
| 69 |
|
*/ |
| 70 |
|
template <typename TPixelType, typename TCellTraits> |
| 71 |
|
void |
| 72 |
|
CellInterface< TPixelType , TCellTraits > |
| 73 |
|
::AddUsingCell(CellIdentifier cellId) |
| 74 |
|
{ |
| 75 |
|
m_UsingCells.insert(cellId); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
|
| 79 |
|
/** |
| 80 |
|
* Remove a cell from the UsingCellsContainer. |
| 81 |
|
*/ |
| 82 |
|
template <typename TPixelType, typename TCellTraits> |
| 83 |
|
void |
| 84 |
|
CellInterface< TPixelType , TCellTraits > |
| 85 |
|
::RemoveUsingCell(CellIdentifier cellId) |
| 86 |
|
{ |
| 87 |
|
m_UsingCells.erase(cellId); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
/** |
| 91 |
|
* Test if a cell is in the UsingCellsContainer. A result of \c true |
| 92 |
|
* indicates that this cell is part of the boundary of the cell \c |
| 93 |
|
* cellId, assuming that boundary information has been recorded. |
| 94 |
|
*/ |
| 95 |
|
template <typename TPixelType, typename TCellTraits> |
| 96 |
|
bool |
| 97 |
|
CellInterface< TPixelType , TCellTraits > |
| 98 |
|
::IsUsingCell(CellIdentifier cellId) |
| 99 |
|
{ |
| 100 |
|
return (m_UsingCells.count(cellId) > 0); |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
|
| 104 |
|
/** |
| 105 |
|
* Get the number of cells in the UsingCellsContainer. |
| 106 |
|
*/ |
| 107 |
|
template <typename TPixelType, typename TCellTraits> |
| 108 |
|
unsigned int |
| 109 |
|
CellInterface< TPixelType , TCellTraits > |
| 110 |
|
::GetNumberOfUsingCells(void) |
| 111 |
|
{ |
| 112 |
|
return static_cast<unsigned int>( m_UsingCells.size() ); |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
|
| 116 |
|
/** |
| 117 |
|
* Get a begin iterator for the UsingCellsContainer. |
| 118 |
|
*/ |
| 119 |
|
template <typename TPixelType, typename TCellTraits> |
| 120 |
|
typename CellInterface< TPixelType , TCellTraits >::UsingCellsContainerIterator |
| 121 |
|
CellInterface< TPixelType , TCellTraits > |
| 122 |
|
::UsingCellsBegin(void) |
| 123 |
|
{ |
| 124 |
|
return m_UsingCells.begin(); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
|
| 128 |
|
/** |
| 129 |
|
* Get an end iterator for the UsingCellsContainer. |
| 130 |
|
*/ |
| 131 |
|
template <typename TPixelType, typename TCellTraits> |
| 132 |
|
typename CellInterface< TPixelType , TCellTraits >::UsingCellsContainerIterator |
| 133 |
|
CellInterface< TPixelType , TCellTraits > |
| 134 |
|
::UsingCellsEnd(void) |
| 135 |
|
{ |
| 136 |
|
return m_UsingCells.end(); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
} // end namespace itk |
| 140 |
|
|
| 141 |
|
#endif |
| 142 |
|
|