PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusBoneEnhancer.h
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #ifndef __vtkPlusBoneEnhancer_h
8 #define __vtkPlusBoneEnhancer_h
9 
10 // Local includes
11 #include "vtkPlusImageProcessingExport.h"
13 #include "vtkImageAlgorithm.h"
14 
15 // VTK includes
16 #include <vtkSmartPointer.h>
17 #include <vtkSetGet.h>
18 
19 class vtkImageData;
20 class vtkImageThreshold;
21 class vtkImageGaussianSmooth;
22 class vtkImageSobel2D;
23 class vtkImageIslandRemoval2D;
24 class vtkImageDilateErode3D;
26 
32 class vtkPlusImageProcessingExport vtkPlusBoneEnhancer : public vtkPlusTrackedFrameProcessor
33 {
34 public:
35  static vtkPlusBoneEnhancer* New();
37  virtual void PrintSelf(ostream& os, vtkIndent indent);
38 
40  virtual PlusStatus ProcessFrame(igsioTrackedFrame* inputFrame, igsioTrackedFrame* outputFrame);
41 
43  virtual PlusStatus ReadConfiguration(vtkSmartPointer<vtkXMLDataElement> processingElement);
44 
46  virtual PlusStatus WriteConfiguration(vtkSmartPointer<vtkXMLDataElement> processingElement);
47 
49  virtual const char* GetProcessorTypeName() { return "vtkPlusBoneEnhancer"; };
50 
52  vtkSetMacro(IntermediateImageFileName, std::string);
53  vtkSetMacro(SaveIntermediateResults, bool);
54  vtkGetMacro(SaveIntermediateResults, bool);
55 
57  vtkSetMacro(NumberOfScanLines, int);
58  vtkGetMacro(NumberOfScanLines, int);
59 
60  vtkSetMacro(NumberOfSamplesPerScanLine, int);
61  vtkGetMacro(NumberOfSamplesPerScanLine, int);
62 
63  vtkSetVector3Macro(MmToPixelFanImage, double);
64  vtkGetVector3Macro(MmToPixelFanImage, double);
65 
66  vtkSetMacro(RadiusStartMm, int);
67  vtkGetMacro(RadiusStartMm, int);
68 
69  vtkSetMacro(RadiusStopMm, int);
70  vtkGetMacro(RadiusStopMm, int);
71 
72  vtkSetMacro(ThetaStartDeg, int);
73  vtkGetMacro(ThetaStartDeg, int);
74 
75  vtkSetMacro(ThetaStopDeg, int);
76  vtkGetMacro(ThetaStopDeg, int);
77 
78  void SetGaussianStdDev(double GaussianStdDev);
79  void SetGaussianKernelSize(double GaussianKernelSize);
80 
81  void SetIslandAreaThreshold(int islandAreaThreshold);
82  vtkGetMacro(IslandAreaThreshold, int);
83 
84  vtkSetVector2Macro(ErosionKernelSize, int);
85  vtkGetVector2Macro(ErosionKernelSize, int);
86 
87  vtkSetVector2Macro(DilationKernelSize, int);
88  vtkGetVector2Macro(DilationKernelSize, int);
89 
90  void ThresholdViaStdDeviation(vtkSmartPointer<vtkImageData> inputImage);
91 
92  vtkImageData* GetProcessedLinesImage() { return (this->ProcessedLinesImage); }
93 
94  void RemoveNoise(vtkSmartPointer<vtkImageData> inputImage);
95  vtkSmartPointer<vtkImageData> UnprocessedFrameToLinearImage(igsioTrackedFrame* inputFrame);
96  void LinearToFanImage(vtkSmartPointer<vtkImageData> inputImage, igsioTrackedFrame* outputFrame);
97 
99  void MarkShadowOutline(vtkSmartPointer<vtkImageData> inputImage);
100 
102  std::map<char*, vtkSmartPointer<vtkIGSIOTrackedFrameList> > GetIntermediateImageMap() { return (this->IntermediateImageMap); };
103  PlusStatus SaveAllIntermediateResultsToFile();
104  PlusStatus SaveIntermediateResultToFile(char* fileNamePostfix);
105 
106 protected:
108  virtual ~vtkPlusBoneEnhancer();
109 
110  void FillLinesImage(vtkSmartPointer<vtkImageData> inputImageData);
111  void VectorImageToUchar(vtkSmartPointer<vtkImageData> inputImage);
112 
113  void ImageConjunction(vtkSmartPointer<vtkImageData> inputImage, vtkSmartPointer<vtkImageData> maskImage);
114 
115  void AddIntermediateImage(char* fileNamePostfix, vtkSmartPointer<vtkImageData> image);
116  void AddIntermediateFromFilter(char* fileNamePostfix, vtkImageAlgorithm* imageAlgorithm);
117 
118  virtual PlusStatus ProcessImageExtents();
119 
120 protected:
121  vtkSmartPointer<vtkPlusUsScanConvert> ScanConverter;
122  vtkSmartPointer<vtkImageGaussianSmooth> GaussianSmooth; // Trying to incorporate existing GaussianSmooth vtkThreadedAlgorithm class
123  vtkSmartPointer<vtkImageSobel2D> EdgeDetector;
124  vtkSmartPointer<vtkImageThreshold> ImageBinarizer;
125  vtkSmartPointer<vtkImageData> BinaryImageForMorphology;
126  vtkSmartPointer<vtkImageIslandRemoval2D> IslandRemover;
127  vtkSmartPointer<vtkImageDilateErode3D> ImageEroder;
128  vtkSmartPointer<vtkImageDilateErode3D> ImageDialator;
129 
133 
134  double MmToPixelFanImage[3];
135 
136  // Scan Conversion parameters, defined in config file
141 
142  // Image processing parameters, defined in config file
145 
146  vtkSmartPointer<vtkImageData> ConversionImage;
148  int ErosionKernelSize[2];
149  int DilationKernelSize[2];
152 
155  std::vector<char*> IntermediatePostfixes;
156 
158  std::map<char*, vtkSmartPointer<vtkIGSIOTrackedFrameList> > IntermediateImageMap;
159 
161  vtkSmartPointer<vtkImageData> LinesImage;
163  vtkSmartPointer<vtkImageData> ProcessedLinesImage;
164 
165  std::vector<std::map<std::string, int> > BoneAreasInfo;
167 
168 private:
169  vtkPlusBoneEnhancer(const vtkPlusBoneEnhancer&); // Not implemented.
170  void operator=(const vtkPlusBoneEnhancer&); // Not implemented.
171 };
172 
173 #endif
vtkSmartPointer< vtkImageGaussianSmooth > GaussianSmooth
vtkSmartPointer< vtkImageSobel2D > EdgeDetector
igsioStatus PlusStatus
Definition: PlusCommon.h:40
vtkSmartPointer< vtkImageDilateErode3D > ImageDialator
vtkSmartPointer< vtkPlusUsScanConvert > ScanConverter
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual const char * GetProcessorTypeName()
vtkSmartPointer< vtkImageThreshold > ImageBinarizer
vtkSmartPointer< vtkImageData > ProcessedLinesImage
vtkSmartPointer< vtkImageIslandRemoval2D > IslandRemover
std::vector< char * > IntermediatePostfixes
virtual PlusStatus ProcessFrame(igsioTrackedFrame *inputFrame, igsioTrackedFrame *outputFrame)=0
vtkImageData * GetProcessedLinesImage()
Simple interface class to allow running various algorithms that process tracked frame lists.
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *processingElement)
This is a base class for defining a common scan conversion algorithm interface for all kinds of probe...
std::string IntermediateImageFileName
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *processingElement)
vtkSmartPointer< vtkImageData > ConversionImage
vtkSmartPointer< vtkImageDilateErode3D > ImageEroder
std::map< char *, vtkSmartPointer< vtkIGSIOTrackedFrameList > > IntermediateImageMap
std::vector< std::map< std::string, int > > BoneAreasInfo
vtkSmartPointer< vtkImageData > BinaryImageForMorphology
vtkSmartPointer< vtkImageData > LinesImage
Localize bone surfaces in ultrasound images.
std::map< char *, vtkSmartPointer< vtkIGSIOTrackedFrameList > > GetIntermediateImageMap()