ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkSparseFieldLevelSetImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSparseFieldLevelSetImageFilter_h
19 #define itkSparseFieldLevelSetImageFilter_h
20 
22 #include "itkMultiThreader.h"
23 #include "itkSparseFieldLayer.h"
24 #include "itkObjectStore.h"
25 #include <vector>
27 
28 namespace itk
29 {
35 template< typename TValue >
37 {
38 public:
39  TValue m_Value;
42 };
43 
72 template< typename TNeighborhoodType >
74 {
75 public:
76  typedef TNeighborhoodType NeighborhoodType;
78  typedef typename NeighborhoodType::RadiusType RadiusType;
79  itkStaticConstMacro(Dimension, unsigned int,
80  NeighborhoodType::Dimension);
82 
83  const RadiusType & GetRadius() const
84  { return m_Radius; }
85 
86  const unsigned int & GetArrayIndex(unsigned int i) const
87  { return m_ArrayIndex[i]; }
88 
89  const OffsetType & GetNeighborhoodOffset(unsigned int i) const
90  { return m_NeighborhoodOffset[i]; }
91 
92  const unsigned int & GetSize() const
93  { return m_Size; }
94 
95  int GetStride(unsigned int i)
96  { return m_StrideTable[i]; }
97 
100 
101  void Print(std::ostream & os) const;
102 
103 private:
104  unsigned int m_Size;
106  std::vector< unsigned int > m_ArrayIndex;
107  std::vector< OffsetType > m_NeighborhoodOffset;
108 
112 };
113 
229 template< typename TInputImage, typename TOutputImage >
231  public FiniteDifferenceImageFilter< TInputImage, TOutputImage >
232 {
233 public:
234 
240 
245 
247  itkNewMacro(Self);
248 
251 
253  typedef TInputImage InputImageType;
254  typedef TOutputImage OutputImageType;
256  itkStaticConstMacro(ImageDimension, unsigned int,
257  TOutputImage::ImageDimension);
258 
262 
265 
269 
271  typedef std::vector< LayerPointerType > LayerListType;
272 
274  typedef signed char StatusType;
275 
280 
284 
286  typedef std::vector< ValueType > UpdateBufferType;
287 
291  itkSetMacro(NumberOfLayers, unsigned int);
292  itkGetConstMacro(NumberOfLayers, unsigned int);
294 
296  itkSetMacro(IsoSurfaceValue, ValueType);
297  itkGetConstMacro(IsoSurfaceValue, ValueType);
299 
303  // itkGetConstMacro(RMSChange, ValueType);
304 
310  itkSetMacro(InterpolateSurfaceLocation, bool);
311  itkGetConstMacro(InterpolateSurfaceLocation, bool);
313 
316  { this->SetInterpolateSurfaceLocation(true); }
318  { this->SetInterpolateSurfaceLocation(false); }
320 
321 #ifdef ITK_USE_CONCEPT_CHECKING
322  // Begin concept checking
323  itkConceptMacro( OutputEqualityComparableCheck,
325  itkConceptMacro( DoubleConvertibleToOutputCheck,
327  itkConceptMacro( OutputOStreamWritableCheck,
329  // End concept checking
330 #endif
331 
332 protected:
335  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
336 
342  const IndexType & itkNotUsed(idx),
343  const TimeStepType & dt,
344  const ValueType & value,
345  const ValueType & change)
346  { return ( value + dt * change ); }
347 
351  virtual void PostProcessOutput() ITK_OVERRIDE;
352 
357  virtual void InitializeBackgroundPixels();
358 
360  void Initialize() ITK_OVERRIDE;
361 
366  void CopyInputToOutput() ITK_OVERRIDE;
367 
369  void AllocateUpdateBuffer() ITK_OVERRIDE;
370 
373  void ApplyUpdate(const TimeStepType& dt) ITK_OVERRIDE;
374 
377  TimeStepType CalculateChange() ITK_OVERRIDE;
378 
382  void ConstructLayer(StatusType from, StatusType to);
383 
388  void ConstructActiveLayer();
389 
392 
401  StatusType promote, int InOrOut);
402 
408 
412  void UpdateActiveLayerValues(TimeStepType dt, LayerType *StatusUpList,
413  LayerType *StatusDownList);
414 
416  void ProcessStatusList(LayerType *InputList, LayerType *OutputList,
417  StatusType ChangeToStatus, StatusType SearchForStatus);
418 
420  void ProcessOutsideList(LayerType *OutsideList, StatusType ChangeToStatus);
421 
422  itkGetConstMacro(ValueZero, ValueType);
423  itkGetConstMacro(ValueOne, ValueType);
424 
428 
432 
434  static ValueType m_ValueOne;
435 
437  static ValueType m_ValueZero;
438 
442 
446 
450 
454 
458 
463 
469 
474  unsigned int m_NumberOfLayers;
475 
478 
481 
483  ValueType m_IsoSurfaceValue;
484 
488 
492  // ValueType m_RMSChange;
493 
499 
502 
503 private:
504  SparseFieldLevelSetImageFilter(const Self &); //purposely not implemented
505  void operator=(const Self &); //purposely not implemented
506 
510 };
511 } // end namespace itk
512 
513 #ifndef ITK_MANUAL_INSTANTIATION
514 #include "itkSparseFieldLevelSetImageFilter.hxx"
515 #endif
516 
517 #endif
void ProcessOutsideList(LayerType *OutsideList, StatusType ChangeToStatus)
SparseFieldCityBlockNeighborList< NeighborhoodIterator< OutputImageType > > m_NeighborList
Light weight base class for most itk classes.
void ConstructLayer(StatusType from, StatusType to)
Image< StatusType, itkGetStaticConstMacro(ImageDimension) > StatusImageType
void ProcessStatusList(LayerType *InputList, LayerType *OutputList, StatusType ChangeToStatus, StatusType SearchForStatus)
A convenience class for storing indices which reference neighbor pixels within a neighborhood.
void ApplyUpdate(const TimeStepType &dt) override
virtual ValueType CalculateUpdateValue(const IndexType &, const TimeStepType &dt, const ValueType &value, const ValueType &change)
TPixel ValueType
Definition: itkImage.h:96
This class implements a finite difference partial differential equation solver for evolving surfaces ...
virtual void PrintSelf(std::ostream &os, Indent indent) const override
FiniteDifferenceFunctionType::NeighborhoodScalesType NeighborhoodScalesType
FiniteDifferenceFunctionType::RadiusType RadiusType
Superclass::IndexType IndexType
Definition: itkImage.h:122
virtual void SetInterpolateSurfaceLocation(bool _arg)
FiniteDifferenceImageFilter< TInputImage, TOutputImage > Superclass
Superclass::NeighborhoodScalesType NeighborhoodScalesType
SparseFieldLevelSetNode< IndexType > LayerNodeType
FiniteDifferenceFunctionType::TimeStepType TimeStepType
void PropagateLayerValues(StatusType from, StatusType to, StatusType promote, int InOrOut)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void PostProcessOutput() override
const unsigned int & GetArrayIndex(unsigned int i) const
TimeStepType CalculateChange() override
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver...
#define itkConceptMacro(name, concept)
A specialized memory management object for allocating and destroying contiguous blocks of objects...
void Print(std::ostream &os) const
void UpdateActiveLayerValues(TimeStepType dt, LayerType *StatusUpList, LayerType *StatusDownList)
const OffsetType & GetNeighborhoodOffset(unsigned int i) const
Defines iteration of a local N-dimensional neighborhood of pixels across an itk::Image.
Templated n-dimensional image class.
Definition: itkImage.h:75