18#ifndef itkParallelSparseFieldLevelSetImageFilter_h
19#define itkParallelSparseFieldLevelSetImageFilter_h
27#include <condition_variable>
37template <
typename TNodeIndexType>
75template <
typename TNeighborhoodType>
80 using OffsetType =
typename NeighborhoodType::OffsetType;
81 using RadiusType =
typename NeighborhoodType::RadiusType;
94 return m_ArrayIndex[i];
100 return m_NeighborhoodOffset[i];
112 return m_StrideTable[i];
119 m_ArrayIndex.clear();
120 m_NeighborhoodOffset.clear();
130 std::vector<unsigned int> m_ArrayIndex{};
131 std::vector<OffsetType> m_NeighborhoodOffset{};
255template <
typename TInputImage,
typename TOutputImage>
269 using typename Superclass::TimeStepType;
270 using typename Superclass::FiniteDifferenceFunctionType;
271 using typename Superclass::RadiusType;
272 using typename Superclass::NeighborhoodScalesType;
285 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
334 const unsigned int indexZ = index[m_SplitAxis];
336 const unsigned int ThreadNum = this->GetThreadNumber(indexZ);
339 return m_Data[ThreadNum].m_Layers[0];
342#ifdef ITK_USE_CONCEPT_CHECKING
361 double m_ConstantGradientValue{ 1.0 };
491 unsigned int InOrOut);
552 return (value +
static_cast<ValueType>(dt) * change);
612 unsigned int InOrOut,
613 unsigned int BufferLayerNumber);
619 unsigned int InOrOut,
620 unsigned int BufferLayerNumber);
631 unsigned int OutputLayerNumber,
633 unsigned int InOrOut,
634 unsigned int BufferLayerNumber,
644 unsigned int OutputLayerNumber,
647 unsigned int InOrOut,
648 unsigned int BufferLayerNumber,
657 unsigned int InOrOut,
658 unsigned int BufferLayerNumber,
666 unsigned int InOrOut,
718 std::vector<TimeStepType> m_TimeStepList{};
726 unsigned int m_SplitAxis{ 0 };
729 unsigned int m_ZSize{ 0 };
733 bool m_BoundaryChanged{
false };
736 unsigned int * m_Boundary{
nullptr };
739 int * m_GlobalZHistogram{
nullptr };
743 unsigned int * m_MapZToThreadNumber{
nullptr };
747 int * m_ZCumulativeFrequency{
nullptr };
786 std::mutex m_Lock[2];
787 std::condition_variable m_Condition[2];
799 ThreadData * m_Data{
nullptr };
803 bool m_Stop{
false };
809 bool m_InterpolateSurfaceLocation{
true };
814 bool m_BoundsCheckingActive{
false };
818#ifndef ITK_MANUAL_INSTANTIATION
819# include "itkParallelSparseFieldLevelSetImageFilter.hxx"
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
OutputPixelType PixelType
Base class for all process objects that output image data.
TOutputImage OutputImageType
TInputImage InputImageType
Templated n-dimensional image class.
Control indentation during Print() invocation.
A specialized memory management object for allocating and destroying contiguous blocks of objects.
A convenience class for storing indices which reference neighbor pixels within a neighborhood.
const OffsetType & GetNeighborhoodOffset(unsigned int i) const
unsigned int GetStride(unsigned int i)
const RadiusType & GetRadius() const
const unsigned int & GetArrayIndex(unsigned int i) const
const unsigned int & GetSize() const
~ParallelSparseFieldCityBlockNeighborList()
typename NeighborhoodType::RadiusType RadiusType
void Print(std::ostream &os, Indent indent) const
TNeighborhoodType NeighborhoodType
typename NeighborhoodType::OffsetType OffsetType
ParallelSparseFieldCityBlockNeighborList()
This class implements a finite difference partial differential equation solver for evolving surfaces ...
void ConstructLayer(const StatusType &from, const StatusType &to)
void CopyInsertList(ThreadIdType ThreadId, LayerPointerType FromListPtr, LayerPointerType ToListPtr)
void ThreadedAllocateData(ThreadIdType ThreadId)
void ComputeInitialThreadBoundaries()
void ClearInterNeighborNodeTransferBufferLayers(ThreadIdType ThreadId, unsigned int InOrOut, unsigned int BufferLayerNumber)
void GenerateData() override
virtual void ThreadedApplyUpdate(const TimeStepType &dt, ThreadIdType ThreadId)
void AllocateUpdateBuffer() override
void ProcessStatusList(LayerType *InputList, const StatusType &ChangeToStatus, const StatusType &SearchForStatus, ThreadIdType ThreadId)
virtual ValueType ThreadedCalculateUpdateValue(const ThreadIdType, const IndexType, const TimeStepType &dt, const ValueType &value, const ValueType &change)
unsigned int GetThreadNumber(unsigned int splitAxisValue)
static StatusType m_StatusActiveChangingUp
void ThreadedProcessFirstLayerStatusLists(unsigned int InputLayerNumber, unsigned int OutputLayerNumber, const StatusType &SearchForStatus, unsigned int InOrOut, unsigned int BufferLayerNumber, ThreadIdType ThreadId)
void ThreadedLoadBalance2(ThreadIdType ThreadId)
virtual TimeStepType ThreadedCalculateChange(ThreadIdType ThreadId)
void GetThreadRegionSplitUniformly(ThreadIdType ThreadId, ThreadRegionType &ThreadRegion)
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, ThreadDataPadded, ThreadData)
ParallelSparseFieldLevelSetImageFilter()
void CopyInputToOutput() override
typename OutputImageType::RegionType ThreadRegionType
void ThreadedInitializeData(ThreadIdType ThreadId, const ThreadRegionType &ThreadRegion)
std::vector< LayerPointerType > LayerListType
void SignalNeighborsAndWait(ThreadIdType ThreadId)
static StatusType m_StatusActiveChangingDown
typename LayerType::Pointer LayerPointerType
virtual void CheckLoadBalance()
void ThreadedPostProcessOutput(const ThreadRegionType ®ionToProcess)
void ClearList(ThreadIdType ThreadId, LayerPointerType ListPtr)
void CopyInsertInterNeighborNodeTransferBufferLayers(ThreadIdType ThreadId, LayerPointerType List, unsigned int InOrOut, unsigned int BufferLayerNumber)
void InitializeActiveLayerValues()
static ValueType m_ValueOne
static ValueType m_ValueZero
void ThreadedUpdateActiveLayerValues(const TimeStepType &dt, LayerType *UpList, LayerType *DownList, ThreadIdType ThreadId)
static StatusType m_StatusNull
static StatusType m_StatusChanging
void PropagateAllLayerValues()
void ThreadedProcessOutsideList(unsigned int InputLayerNumber, const StatusType &ChangeToStatus, unsigned int InOrOut, unsigned int BufferLayerNumber, ThreadIdType ThreadId)
TimeStepType CalculateChange() override
void ApplyUpdate(const TimeStepType &) override
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, ThreadDataUnaligned, ThreadDataPadded)
void ThreadedPropagateLayerValues(const StatusType &from, const StatusType &to, const StatusType &promote, unsigned int InOrOut, ThreadIdType ThreadId)
void SignalNeighbor(unsigned int SemaphoreArrayNumber, ThreadIdType ThreadId)
virtual void InitializeBackgroundPixels()
void PropagateLayerValues(const StatusType &from, const StatusType &to, const StatusType &promote, unsigned int InOrOut)
~ParallelSparseFieldLevelSetImageFilter() override=default
void ConstructActiveLayer()
void PrintSelf(std::ostream &os, Indent indent) const override
void Initialize() override
typename OutputImageType::IndexType IndexType
static StatusType m_StatusBoundaryPixel
LayerPointerType GetActiveListForIndex(const IndexType index)
virtual void ThreadedProcessPixelEnteringActiveLayer(const IndexType &, const ValueType &, ThreadIdType)
void GetThreadRegionSplitByBoundary(ThreadIdType ThreadId, ThreadRegionType &ThreadRegion)
typename OutputImageType::ValueType ValueType
void ThreadedLoadBalance1(ThreadIdType ThreadId)
virtual void ThreadedInitializeIteration(ThreadIdType ThreadId)
void WaitForNeighbor(unsigned int SemaphoreArrayNumber, ThreadIdType ThreadId)
void ThreadedProcessStatusList(unsigned int InputLayerNumber, unsigned int OutputLayerNumber, const StatusType &ChangeToStatus, const StatusType &SearchForStatus, unsigned int InOrOut, unsigned int BufferLayerNumber, ThreadIdType ThreadId)
ParallelSparseFieldLevelSetNode * Previous
ParallelSparseFieldLevelSetNode * Next
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver.
SmartPointer< Self > Pointer
#define itkConceptMacro(name, concept)
ImageBaseType::RegionType RegionType
ImageBaseType::IndexType IndexType
constexpr unsigned int Dimension
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
std::vector< Boolean > BooleanStdVectorType
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
unsigned int m_SemaphoreArrayNumber
ThreadRegionType ThreadRegion
LayerListType * m_LoadTransferBufferLayers
LayerNodeStorageType::Pointer m_LayerNodeStore