18 #ifndef itkParallelSparseFieldLevelSetImageFilter_h
19 #define itkParallelSparseFieldLevelSetImageFilter_h
27 #include <condition_variable>
37 template <
typename TNodeIndexType>
75 template <
typename TNeighborhoodType>
94 return m_ArrayIndex[i];
100 return m_NeighborhoodOffset[i];
112 return m_StrideTable[i];
119 m_ArrayIndex.clear();
120 m_NeighborhoodOffset.clear();
124 Print(std::ostream & os,
Indent indent)
const;
130 std::vector<unsigned int> m_ArrayIndex{};
131 std::vector<OffsetType> m_NeighborhoodOffset{};
255 template <
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;
327 itkGetConstMacro(IsoSurfaceValue,
ValueType);
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
354 PrintSelf(std::ostream & os,
Indent indent)
const override;
361 double m_ConstantGradientValue{ 1.0 };
430 GenerateData()
override;
437 CopyInputToOutput()
override;
447 Initialize()
override;
454 ConstructActiveLayer();
458 InitializeActiveLayerValues();
464 ConstructLayer(
const StatusType & from,
const StatusType & to);
468 ProcessStatusList(LayerType * InputList,
469 const StatusType & ChangeToStatus,
470 const StatusType & SearchForStatus,
478 PropagateAllLayerValues();
488 PropagateLayerValues(
const StatusType & from,
489 const StatusType & to,
490 const StatusType & promote,
491 unsigned int InOrOut);
498 InitializeBackgroundPixels();
507 ThreadedInitializeData(
ThreadIdType ThreadId,
const ThreadRegionType & ThreadRegion);
519 ComputeInitialThreadBoundaries();
523 GetThreadNumber(
unsigned int splitAxisValue);
527 GetThreadRegionSplitByBoundary(
ThreadIdType ThreadId, ThreadRegionType & ThreadRegion);
545 inline virtual ValueType
552 return (value + static_cast<ValueType>(dt) * change);
560 ThreadedProcessPixelEnteringActiveLayer(
const IndexType & itkNotUsed(index),
561 const ValueType & itkNotUsed(value),
572 ThreadedApplyUpdate(
const TimeStepType & dt,
ThreadIdType ThreadId);
593 ThreadedUpdateActiveLayerValues(
const TimeStepType & dt,
595 LayerType * DownList,
601 CopyInsertList(
ThreadIdType ThreadId, LayerPointerType FromListPtr, LayerPointerType ToListPtr);
605 ClearList(
ThreadIdType ThreadId, LayerPointerType ListPtr);
610 CopyInsertInterNeighborNodeTransferBufferLayers(
ThreadIdType ThreadId,
611 LayerPointerType List,
612 unsigned int InOrOut,
613 unsigned int BufferLayerNumber);
618 ClearInterNeighborNodeTransferBufferLayers(
ThreadIdType ThreadId,
619 unsigned int InOrOut,
620 unsigned int BufferLayerNumber);
630 ThreadedProcessFirstLayerStatusLists(
unsigned int InputLayerNumber,
631 unsigned int OutputLayerNumber,
632 const StatusType & SearchForStatus,
633 unsigned int InOrOut,
634 unsigned int BufferLayerNumber,
643 ThreadedProcessStatusList(
unsigned int InputLayerNumber,
644 unsigned int OutputLayerNumber,
645 const StatusType & ChangeToStatus,
646 const StatusType & SearchForStatus,
647 unsigned int InOrOut,
648 unsigned int BufferLayerNumber,
655 ThreadedProcessOutsideList(
unsigned int InputLayerNumber,
656 const StatusType & ChangeToStatus,
657 unsigned int InOrOut,
658 unsigned int BufferLayerNumber,
663 ThreadedPropagateLayerValues(
const StatusType & from,
664 const StatusType & to,
665 const StatusType & promote,
666 unsigned int InOrOut,
672 GetThreadRegionSplitUniformly(
ThreadIdType ThreadId, ThreadRegionType & ThreadRegion);
680 ThreadedPostProcessOutput(
const ThreadRegionType & regionToProcess);
707 SignalNeighbor(
unsigned int SemaphoreArrayNumber,
ThreadIdType ThreadId);
710 WaitForNeighbor(
unsigned int SemaphoreArrayNumber,
ThreadIdType ThreadId);
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];
795 itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, ThreadDataPadded, ThreadData);
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"