19 #include <vtkImageShiftScale.h>
20 #include <vtkSmartPointer.h>
46 int tstart = outputRegion.GetIndex(3);
47 int tmax = tstart + outputRegion.GetSize(3);
49 ScalarType thresholdExpanded = this->m_Threshold;
51 if ((tmax - tstart) > 0)
60 for (
int t = tstart; t < tmax; ++t)
65 MITK_INFO << (m_MedianFilter3D ?
"Applying median..." :
"No median filtering");
69 median->SetInputData(vtkimage);
70 median->SetKernelSize(m_MedianKernelSizeX, m_MedianKernelSizeY, m_MedianKernelSizeZ);
71 median->ReleaseDataFlagOn();
72 median->UpdateInformation();
74 vtkimage = median->GetOutput();
80 MITK_INFO << (m_Interpolation ?
"Resampling..." :
"No resampling");
84 imageresample->SetInputData(vtkimage);
87 imageresample->SetAxisOutputSpacing(0, m_InterpolationX);
88 imageresample->SetAxisOutputSpacing(1, m_InterpolationY);
89 imageresample->SetAxisOutputSpacing(2, m_InterpolationZ);
90 imageresample->UpdateInformation();
91 imageresample->Update();
92 vtkimage = imageresample->GetOutput();
93 imageresample->Delete();
97 MITK_INFO << (m_UseGaussianImageSmooth ?
"Applying gaussian smoothing..." :
"No gaussian smoothing");
98 if (m_UseGaussianImageSmooth)
101 scalefilter->SetScale(100);
102 scalefilter->SetInputData(vtkimage);
103 scalefilter->Update();
106 gaussian->SetInputConnection(scalefilter->GetOutputPort());
107 gaussian->SetDimensionality(3);
108 gaussian->SetRadiusFactor(0.49);
109 gaussian->SetStandardDeviation(m_GaussianStandardDeviation);
110 gaussian->ReleaseDataFlagOn();
111 gaussian->UpdateInformation();
114 vtkimage = scalefilter->GetOutput();
117 vtkimage->GetScalarRange(range);
119 MITK_DEBUG <<
"Current scalar max is: " << range[1];
122 vtkimage = gaussian->GetOutput();
126 MITK_INFO <<
"Smoothing removes all pixels of the segmentation. Use unsmoothed result";
129 scalefilter->Delete();
134 CreateSurface(t, vtkimage, surface, thresholdExpanded);
138 MITK_INFO <<
"Updating Time Geometry to ensure right timely displaying";
145 assert(surfacePTG !=
nullptr);
146 assert(imagePTG !=
nullptr);
147 if ((surfacePTG !=
nullptr) && (imagePTG !=
nullptr))
153 MITK_INFO <<
"First Time Point: " << firstTime <<
" Duration: " << duration;
159 m_MedianKernelSizeX = x;
160 m_MedianKernelSizeY = y;
161 m_MedianKernelSizeZ = z;
166 m_InterpolationX = x;
167 m_InterpolationY = y;
168 m_InterpolationZ = z;
double m_GaussianStandardDeviation
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
bool m_UseGaussianImageSmooth
Class for storing surfaces (vtkPolyData).
virtual void SetStepDuration(TimePointType _arg)
vtkDouble m_InterpolationY
virtual const RegionType & GetRequestedRegion() const
vtkDouble m_InterpolationZ
virtual ~ManualSegmentationToSurfaceFilter()
virtual vtkImageData * GetVtkImageData(int t=0, int n=0)
Get a volume at a specific time t of channel n as a vtkImageData.
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
virtual TimePointType GetFirstTimePoint() const
vtkDouble m_InterpolationX
static ProgressBar * GetInstance()
static method to get the GUI dependent ProgressBar-instance so the methods for steps to do and progre...
ManualSegmentationToSurfaceFilter()
virtual TimePointType GetStepDuration() const
virtual void SetInterpolation(bool _arg)
void SetMedianKernelSize(int x, int y, int z)
itk::ImageRegion< RegionDimension > RegionType
Image class for storing images.
virtual void GenerateData() override
mitk::ScalarType TimePointType
virtual void SetFirstTimePoint(TimePointType _arg)
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.