15 #include <vtkImageShiftScale.h> 16 #include <vtkSmartPointer.h> 42 int tstart = outputRegion.GetIndex(3);
43 int tmax = tstart + outputRegion.GetSize(3);
47 if ((tmax - tstart) > 0)
56 for (
int t = tstart; t < tmax; ++t)
58 vtkSmartPointer<vtkImageData> vtkimage =
image->GetVtkImageData(t);
64 vtkImageMedian3D *median = vtkImageMedian3D::New();
65 median->SetInputData(vtkimage);
67 median->ReleaseDataFlagOn();
68 median->UpdateInformation();
70 vtkimage = median->GetOutput();
79 vtkImageResample *imageresample = vtkImageResample::New();
80 imageresample->SetInputData(vtkimage);
86 imageresample->UpdateInformation();
87 imageresample->Update();
88 vtkimage = imageresample->GetOutput();
89 imageresample->Delete();
96 vtkImageShiftScale *scalefilter = vtkImageShiftScale::New();
97 scalefilter->SetScale(100);
98 scalefilter->SetInputData(vtkimage);
99 scalefilter->Update();
101 vtkImageGaussianSmooth *gaussian = vtkImageGaussianSmooth::New();
102 gaussian->SetInputConnection(scalefilter->GetOutputPort());
103 gaussian->SetDimensionality(3);
104 gaussian->SetRadiusFactor(0.49);
106 gaussian->ReleaseDataFlagOn();
107 gaussian->UpdateInformation();
110 vtkimage = scalefilter->GetOutput();
113 vtkimage->GetScalarRange(range);
117 vtkimage = gaussian->GetOutput();
121 MITK_INFO <<
"Smoothing would remove all pixels of the segmentation. Use unsmoothed result instead.";
124 scalefilter->Delete();
140 assert(surfacePTG !=
nullptr);
141 assert(imagePTG !=
nullptr);
142 if ((surfacePTG !=
nullptr) && (imagePTG !=
nullptr))
146 surfacePTG->SetFirstTimePoint(firstTime);
147 surfacePTG->SetStepDuration(duration);
double m_GaussianStandardDeviation
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
~ManualSegmentationToSurfaceFilter() override
bool m_UseGaussianImageSmooth
Class for storing surfaces (vtkPolyData).
vtkDouble m_InterpolationY
vtkDouble m_InterpolationZ
const mitk::Image * GetInput(void)
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 void SetInterpolation(bool _arg)
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
void SetMedianKernelSize(int x, int y, int z)
itk::ImageRegion< RegionDimension > RegionType
Image class for storing images.
void GenerateData() override
mitk::ScalarType TimePointType
void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold)
mitk::Image::Pointer image
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.