18 #ifndef itkParallelSparseFieldLevelSetImageFilter_h
19 #define itkParallelSparseFieldLevelSetImageFilter_h
27 #include <condition_variable>
37 template<
typename TNodeIndexType >
75 template<
typename TNeighborhoodType >
92 return m_ArrayIndex[i];
97 return m_NeighborhoodOffset[i];
107 return m_StrideTable[i];
114 m_ArrayIndex.clear();
115 m_NeighborhoodOffset.clear();
118 void Print(std::ostream & os)
const;
249 template<
typename TInputImage,
typename TOutputImage >
279 static constexpr
unsigned int ImageDimension = TOutputImage::ImageDimension;
321 itkGetConstMacro(IsoSurfaceValue,
ValueType);
327 const unsigned int indexZ = index[m_SplitAxis];
329 const unsigned int ThreadNum = this->GetThreadNumber (indexZ);
332 return m_Data[ThreadNum].m_Layers[0];
335 #ifdef ITK_USE_CONCEPT_CHECKING
349 void PrintSelf(std::ostream & os,
Indent indent)
const override;
357 double m_ConstantGradientValue{1.0};
425 void GenerateData()
override;
431 void CopyInputToOutput()
override;
438 void Initialize()
override;
444 void ConstructActiveLayer();
447 void InitializeActiveLayerValues();
452 void ConstructLayer(
const StatusType& from,
const StatusType& to);
455 void ProcessStatusList(LayerType *InputList,
const StatusType& ChangeToStatus,
456 const StatusType& SearchForStatus,
ThreadIdType ThreadId);
462 void PropagateAllLayerValues();
471 void PropagateLayerValues(
const StatusType& from,
const StatusType& to,
472 const StatusType& promote,
unsigned int InOrOut);
478 virtual void InitializeBackgroundPixels();
485 void ThreadedInitializeData(
ThreadIdType ThreadId,
const ThreadRegionType & ThreadRegion);
496 void ComputeInitialThreadBoundaries();
499 unsigned int GetThreadNumber(
unsigned int splitAxisValue);
502 void GetThreadRegionSplitByBoundary(
ThreadIdType ThreadId, ThreadRegionType & ThreadRegion);
506 void DeallocateData();
534 return ( value + static_cast< ValueType >( dt ) * change );
541 virtual void ThreadedProcessPixelEnteringActiveLayer(
const IndexType& itkNotUsed(index),
542 const ValueType& itkNotUsed(value),
550 virtual void ThreadedApplyUpdate(
const TimeStepType& dt,
ThreadIdType ThreadId);
560 virtual TimeStepType ThreadedCalculateChange(
ThreadIdType ThreadId);
568 void ThreadedUpdateActiveLayerValues(
const TimeStepType& dt,
569 LayerType *StatusUpList,
570 LayerType *StatusDownList,
576 LayerPointerType FromListPtr,
577 LayerPointerType ToListPtr);
580 void ClearList(
ThreadIdType ThreadId, LayerPointerType ListPtr);
584 void CopyInsertInterNeighborNodeTransferBufferLayers(
586 LayerPointerType InputList,
587 unsigned int InOrOut,
588 unsigned int BufferLayerNumber);
592 void ClearInterNeighborNodeTransferBufferLayers(
594 unsigned int BufferLayerNumber);
603 void ThreadedProcessFirstLayerStatusLists(
604 unsigned int InputLayerNumber,
605 unsigned int OutputLayerNumber,
606 const StatusType& SearchForStatus,
607 unsigned int InOrOut,
608 unsigned int BufferLayerNumber,
616 void ThreadedProcessStatusList(
617 unsigned int InputLayerNumber,
618 unsigned int OutputLayerNumber,
619 const StatusType& ChangeToStatus,
620 const StatusType& SearchForStatus,
621 unsigned int InOrOut,
622 unsigned int BufferLayerNumber,
628 void ThreadedProcessOutsideList(
629 unsigned int InputLayerNumber,
630 const StatusType& ChangeToStatus,
631 unsigned int InOrOut,
632 unsigned int BufferLayerNumber,
636 void ThreadedPropagateLayerValues(
637 const StatusType& from,
638 const StatusType& to,
639 const StatusType& promote,
640 unsigned int InorOut,
645 void GetThreadRegionSplitUniformly(
646 ThreadIdType ThreadId, ThreadRegionType & ThreadRegion);
653 void ThreadedPostProcessOutput(
const ThreadRegionType & regionToProcess);
665 virtual void CheckLoadBalance();
669 virtual void ThreadedLoadBalance(
ThreadIdType ThreadId);
676 void SignalNeighbor(
unsigned int SemaphoreArrayNumber,
ThreadIdType ThreadId);
678 void WaitForNeighbor(
unsigned int SemaphoreArrayNumber,
ThreadIdType ThreadId);
682 virtual void ThreadedInitializeIteration(
ThreadIdType ThreadId);
692 unsigned int m_SplitAxis{0};
695 unsigned int m_ZSize{0};
699 bool m_BoundaryChanged{
false};
702 unsigned int *m_Boundary{
nullptr};
705 int *m_GlobalZHistogram{
nullptr};
709 unsigned int *m_MapZToThreadNumber{
nullptr};
713 int *m_ZCumulativeFrequency{
nullptr};
756 std::mutex m_Lock[2];
757 std::condition_variable m_Condition[2];
778 bool m_InterpolateSurfaceLocation{
true};
784 bool m_BoundsCheckingActive{
false};
788 #ifndef ITK_MANUAL_INSTANTIATION
789 #include "itkParallelSparseFieldLevelSetImageFilter.hxx"
A convenience class for storing indices which reference neighbor pixels within a neighborhood.
std::vector< LayerPointerType > LayerListType
std::vector< TimeStepType > TimeStepList
const OffsetType & GetNeighborhoodOffset(unsigned int i) const
typename FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
const RadiusType & GetRadius() const
LayerNodeStorageType::Pointer m_LayerNodeStore
Barrier::Pointer m_Barrier
ParallelSparseFieldLevelSetImageFilter * Filter
OutputImageType::Pointer m_OutputImageTemp
static StatusType m_StatusNull
Define numeric traits for std::vector.
static StatusType m_StatusChanging
static StatusType m_StatusBoundaryPixel
unsigned int GetStride(unsigned int i)
StatusImageType::Pointer m_StatusImageTemp
ParallelSparseFieldCityBlockNeighborList< NeighborhoodIterator< OutputImageType > > m_NeighborList
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
OutputImageType::Pointer m_OutputImage
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
OutputPixelType PixelType
LayerNodeStorageType::Pointer m_LayerNodeStore
ValueType m_IsoSurfaceValue
Base class for all process objects that output image data.
constexpr unsigned int Dimension
TInputImage InputImageType
~ParallelSparseFieldCityBlockNeighborList()
static StatusType m_StatusActiveChangingUp
const unsigned int & GetArrayIndex(unsigned int i) const
ParallelSparseFieldLevelSetNode * Previous
typename OutputImageType::RegionType ThreadRegionType
ParallelSparseFieldLevelSetNode * Next
typename NeighborhoodType::OffsetType OffsetType
static StatusType m_StatusActiveChangingDown
virtual ValueType ThreadedCalculateUpdateValue(const ThreadIdType, const IndexType, const TimeStepType &dt, const ValueType &value, const ValueType &change)
This class implements a finite difference partial differential equation solver for evolving surfaces ...
typename OutputImageType::ValueType ValueType
LayerListType * m_LoadTransferBufferLayers
ImageBaseType::IndexType IndexType
std::vector< bool > ValidTimeStepList
TOutputImage OutputImageType
std::vector< unsigned int > m_ArrayIndex
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image...
ThreadRegionType ThreadRegion
OutputImageType::Pointer m_ShiftedImage
static ValueType m_ValueZero
unsigned int m_SemaphoreArrayNumber
unsigned int ThreadIdType
typename Superclass::RadiusType RadiusType
typename OutputImageType::IndexType IndexType
typename LayerType::Pointer LayerPointerType
void ApplyUpdate(const TimeStepType &) override
StatusImageType::Pointer m_StatusImage
void AllocateUpdateBuffer() override
typename Superclass::OffsetType OffsetType
LayerPointerType GetActiveListForIndex(const IndexType index)
std::vector< OffsetType > m_NeighborhoodOffset
Control indentation during Print() invocation.
static ValueType m_ValueOne
TimeStepType CalculateChange() override
typename NeighborhoodType::RadiusType RadiusType
ImageBaseType::RegionType RegionType
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver...
typename FiniteDifferenceFunctionType::RadiusType RadiusType
#define itkConceptMacro(name, concept)
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
const unsigned int & GetSize() const
A specialized memory management object for allocating and destroying contiguous blocks of objects...
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
Templated n-dimensional image class.
StatusType m_NumberOfLayers