[dd2e6a]: / includes / Masking / MaskingMethods / RayMasking.h

Download this file

68 lines (56 with data), 2.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "../MaskingStrategy.h"
#include "itkConnectedComponentImageFilter.h"
#include "itkLabelShapeKeepNObjectsImageFilter.h"
#include <sitkDiscreteGaussianImageFilter.h>
#include <itkBinaryThresholdImageFilter.h>
#include <itkImageRegionIterator.h>
#include <itkImageRegionConstIterator.h>
#include <itkExtractImageFilter.h>
#include <itkPathConstIterator.h>
#include "itkCastImageFilter.h"
#include "itkTileImageFilter.h"
#include <itkChainCodePath2D.h>
#include <itkImage.h>
#include <SimpleITK.h>
#include <iostream>
#include <math.h>
namespace sitk = itk::simple;
using InputPixelType = int;
using MaskPixelType = uint8_t;
using InputImageType = itk::Image< InputPixelType, 3 >;
using InputImage2DType = itk::Image< InputPixelType, 2 >;
using MaskImage2DType = itk::Image< MaskPixelType, 2 >;
using MaskImageType = itk::Image< MaskPixelType, 3 >;
using FilterType = itk::BinaryThresholdImageFilter< InputImageType, MaskImageType >;
using ExtractFilterType = itk::ExtractImageFilter< MaskImageType, MaskImage2DType >;
using TileMaskFilterType = itk::TileImageFilter< MaskImage2DType, MaskImageType >;
using TileImageFilterType = itk::TileImageFilter< InputImage2DType, InputImageType >;
using ConnectedComponentImageFilterType = itk::ConnectedComponentImageFilter < MaskImage2DType, InputImage2DType >;
using LabelShapeKeepNObjectsImageFilterType = itk::LabelShapeKeepNObjectsImageFilter< InputImage2DType >;
using iterType = itk::ImageRegionIterator<MaskImage2DType>;
using constIterType = itk::ImageRegionConstIterator<MaskImage2DType>;
using chainCodeType = itk::ChainCodePath2D;
using pathConstIterType = itk::PathConstIterator< MaskImage2DType, chainCodeType >;
class RayMasking : public MaskingStrategy
{
private:
const InputPixelType lowerThreshold = -20;
const InputPixelType upperThreshold = 90;
const InputPixelType boneLowerThreshold = 300;
const InputPixelType boneUpperThreshold = 2000;
sitk::CastImageFilter caster;
sitk::BinaryThresholdImageFilter binaryThresholdImageFilter;
sitk::DiscreteGaussianImageFilter gaussianFilter;
TileMaskFilterType::Pointer tileMaskFilter = TileMaskFilterType::New();
TileImageFilterType::Pointer tileFilter = TileImageFilterType::New();
ConnectedComponentImageFilterType::Pointer connCompFilter = ConnectedComponentImageFilterType::New();
LabelShapeKeepNObjectsImageFilterType::Pointer labelShapeKeepNObjectsImageFilter = LabelShapeKeepNObjectsImageFilterType::New();
public:
RayMasking(sitk::Image &image);
void run();
private:
sitk::Image isolateIntracranialVoxels(sitk::Image &initialMask, sitk::Image &boneMask);
sitk::Image LCC( sitk::Image inputMask, int axis);
void sitkToBinaryItk( const sitk::Image &image, MaskImageType::Pointer &outputImage );
};