ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkAttenuationImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkAttenuationImageFilter_h
19#define itkAttenuationImageFilter_h
20
21#include <vector>
22
23#include "itkImage.h"
26#include "itkMacro.h"
27
28#include "itkNumericTraits.h"
29
30namespace itk
31{
71template <typename TInputImage,
72 typename TOutputImage = itk::Image<float, TInputImage::ImageDimension>,
73 typename TMaskImage = itk::Image<unsigned char, TInputImage::ImageDimension>>
74class ITK_TEMPLATE_EXPORT AttenuationImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
75{
76public:
77 ITK_DISALLOW_COPY_AND_MOVE(AttenuationImageFilter);
78
84
86 itkNewMacro(Self);
87
89 itkOverrideGetNameOfClassMacro(AttenuationImageFilter);
90
92 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
93
94 using InputImageType = TInputImage;
95 using InputImagePointer = typename TInputImage::Pointer;
96
97 using OutputImageType = TOutputImage;
98 using OutputImagePointer = typename TOutputImage::Pointer;
99
100 using MaskImageType = TMaskImage;
101 using MaskImagePointer = typename TMaskImage::Pointer;
102 using MaskPixelType = typename TMaskImage::PixelType;
103
104 using InputRegionType = typename TInputImage::RegionType;
105 using InputSizeType = typename TInputImage::SizeType;
106 using InputIndexType = typename TInputImage::IndexType;
107 using InputPixelType = typename TInputImage::PixelType;
108
109 using OutputRegionType = typename TOutputImage::RegionType;
110 using OutputPixelType = typename TOutputImage::PixelType;
111
113 itkSetInputMacro(InputMaskImage, TMaskImage);
114 itkGetInputMacro(InputMaskImage, TMaskImage);
115
118 virtual const MaskImageType *
120 {
121 return dynamic_cast<const MaskImageType *>(this->ProcessObject::GetOutput(1));
122 }
123 virtual MaskImageType *
125 {
126 return dynamic_cast<MaskImageType *>(this->ProcessObject::GetOutput(1));
127 }
128
129 MaskImageType *
130 GetOutput(unsigned int idx)
131 {
132 if (idx == 0)
133 {
134 // Pythonic interface invokes this in a for loop because filter has multiple outputs
135 return reinterpret_cast<MaskImageType *>(this->GetOutput());
136 }
137 else if (idx != 1)
138 {
139 itkExceptionMacro("This filter has only two outputs");
140 }
141 return this->GetOutputMaskImage();
142 }
143
144 TOutputImage *
146 {
147 return this->Superclass::GetOutput();
148 }
149
162 itkSetMacro(ComputationMode, unsigned int);
163 itkGetConstMacro(ComputationMode, unsigned int);
164
169 itkGetConstMacro(LabelValue, MaskPixelType);
170
176 itkSetMacro(FixedEstimationDepth, unsigned int);
177 itkGetConstMacro(FixedEstimationDepth, unsigned int);
178
181 void
182 SetFixedEstimationDepthMM(const float distanceMM);
183 float
185
187 itkSetMacro(Direction, unsigned int);
188 itkGetConstMacro(Direction, unsigned int);
189
191 itkSetMacro(SamplingFrequencyMHz, float);
192 itkGetConstMacro(SamplingFrequencyMHz, float);
193
195 itkSetMacro(FrequencyBandStartMHz, float);
196 itkGetConstMacro(FrequencyBandStartMHz, float);
197
198 /* High end of RF frequency band. Must be a positive value.*/
199 itkSetMacro(FrequencyBandEndMHz, float);
200 itkGetConstMacro(FrequencyBandEndMHz, float);
201
207 itkSetMacro(ConsiderNegativeAttenuations, bool);
208 itkGetConstMacro(ConsiderNegativeAttenuations, bool);
209
215 itkSetMacro(PadUpperBounds, unsigned int);
216 itkGetConstMacro(PadUpperBounds, unsigned int);
218 itkSetMacro(PadLowerBounds, unsigned int);
219 itkGetConstMacro(PadLowerBounds, unsigned int);
220
223 void
224 SetPadLowerBoundsMM(const float distanceMM);
225 float
227
230 void
231 SetPadUpperBoundsMM(const float distanceMM);
232 float
234
235 // Alias for setting direction of RF waveform in data collection
236 void
237 SetScanDirection(unsigned int direction)
238 {
239 this->SetDirection(direction);
240 };
241 unsigned int
243 {
244 return this->GetDirection();
245 };
246
247 void
248 PrintSelf(std::ostream & os, Indent indent) const override;
249
256
257protected:
259 ~AttenuationImageFilter() override = default;
260
261 void
262 VerifyPreconditions() const override;
263
265 void
267
268 void
269 ThreadedGenerateData(const OutputRegionType & regionForThread, ThreadIdType) override;
270
272 GetImageRegionSplitter() const override;
273
277 ComputeAttenuation(const InputIndexType & end, const InputIndexType & start) const;
278
283 float
285
289 float
290 TransformPixelToPhysicalScanLineDistance(unsigned int distance) const;
291
293 bool
295
296private:
297 unsigned int m_ComputationMode = 0;
299 unsigned int m_Direction = 0;
300 unsigned int m_FixedEstimationDepth = 0;
301 unsigned int m_PadUpperBounds = 0;
302 unsigned int m_PadLowerBounds = 0;
303
304 std::vector<float> m_DistanceWeights;
305
306 float m_ScanStepMM = 1.0f;
310 float m_FrequencyDelta = 0.0f;
311
312 // Frequency band to consider for attenuation
313 unsigned int m_StartComponent = 0;
314 unsigned int m_EndComponent = 0;
315 unsigned int m_ConsideredComponents = 1;
316
318
321
324
325 unsigned int m_LastScanlineIndex = 0;
326};
327} // end namespace itk
328
329#ifndef ITK_MANUAL_INSTANTIATION
330# include "itkAttenuationImageFilter.hxx"
331#endif
332
333#endif
void BeforeThreadedGenerateData() override
typename TInputImage::IndexType InputIndexType
void SetPadLowerBoundsMM(const float distanceMM)
virtual void SetDirection(unsigned int _arg)
const ImageRegionSplitterBase * GetImageRegionSplitter() const override
Get the image splitter to split the image for multi-threading.
typename TOutputImage::Pointer OutputImagePointer
typename TInputImage::Pointer InputImagePointer
typename TMaskImage::PixelType MaskPixelType
bool ThreadedIsIncluded(InputIndexType index) const
typename TOutputImage::PixelType OutputPixelType
void SetPadUpperBoundsMM(const float distanceMM)
typename TInputImage::PixelType InputPixelType
virtual const MaskImageType * GetOutputMaskImage() const
DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
float TransformPhysicalToPixelScanLineDistance(float distanceMM) const
void SetScanDirection(unsigned int direction)
float GetPadLowerBoundsMM() const
typename TMaskImage::Pointer MaskImagePointer
static constexpr unsigned int ImageDimension
void SetFixedEstimationDepthMM(const float distanceMM)
itkGetInputMacro(InputMaskImage, TMaskImage)
float TransformPixelToPhysicalScanLineDistance(unsigned int distance) const
void ThreadedGenerateData(const OutputRegionType &regionForThread, ThreadIdType) override
virtual unsigned int GetDirection() const
ImageRegionSplitterDirection::Pointer m_RegionSplitter
void PrintSelf(std::ostream &os, Indent indent) const override
~AttenuationImageFilter() override=default
typename TOutputImage::RegionType OutputRegionType
typename TInputImage::RegionType InputRegionType
void VerifyPreconditions() const override
Verifies that the process object has been configured correctly, that all required inputs are set,...
ImageToImageFilter< TInputImage, TOutputImage > Superclass
float GetPadUpperBoundsMM() const
itkSetInputMacro(InputMaskImage, TMaskImage)
typename TInputImage::SizeType InputSizeType
OutputPixelType ComputeAttenuation(const InputIndexType &end, const InputIndexType &start) const
float GetFixedEstimationDepthMM() const
const MaskImageType * m_ThreadedInputMaskImage
virtual MaskImageType * GetOutputMaskImage()
MaskImageType * GetOutput(unsigned int idx)
SmartPointer< const Self > ConstPointer
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
SmartPointer< Self > Pointer
Divide an image region into several pieces.
OutputImageType * GetOutput()
ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
Control indentation during Print() invocation.
Definition itkIndent.h:53
DataObject * GetOutput(const DataObjectIdentifierType &key)
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition itkIntTypes.h:98
#define itkSetMacro(name, type)