Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSurfaceInterpolationController.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 #include "mitkImageAccessByItk.h"
19 #include "mitkImageCast.h"
20 #include "mitkMemoryUtilities.h"
21 
23 //#include "vtkXMLPolyDataWriter.h"
24 #include "vtkPolyDataWriter.h"
25 
26 // Check whether the given contours are coplanar
29 {
30  // Here we check two things:
31  // 1. Whether the normals of both contours are at least parallel
32  // 2. Whether both contours lie in the same plane
33 
34  // Check for coplanarity:
35  // a. Span a vector between two points one from each contour
36  // b. Calculate dot product for the vector and one of the normals
37  // c. If the dot is zero the two vectors are orthogonal and the contours are coplanar
38 
39  double vec[3];
40  vec[0] = leftHandSide.contourPoint[0] - rightHandSide.contourPoint[0];
41  vec[1] = leftHandSide.contourPoint[1] - rightHandSide.contourPoint[1];
42  vec[2] = leftHandSide.contourPoint[2] - rightHandSide.contourPoint[2];
43  double n[3];
44  n[0] = rightHandSide.contourNormal[0];
45  n[1] = rightHandSide.contourNormal[1];
46  n[2] = rightHandSide.contourNormal[2];
47  double dot = vtkMath::Dot(n, vec);
48 
49  double n2[3];
50  n2[0] = leftHandSide.contourNormal[0];
51  n2[1] = leftHandSide.contourNormal[1];
52  n2[2] = leftHandSide.contourNormal[2];
53 
54  // The normals of both contours have to be parallel but not of the same orientation
55  double lengthLHS = leftHandSide.contourNormal.GetNorm();
56  double lengthRHS = rightHandSide.contourNormal.GetNorm();
57  double dot2 = vtkMath::Dot(n, n2);
58  bool contoursParallel = mitk::Equal(fabs(lengthLHS * lengthRHS), fabs(dot2), 0.001);
59 
60  if (mitk::Equal(dot, 0.0, 0.001) && contoursParallel)
61  return true;
62  else
63  return false;
64 }
65 
67  mitk::Surface::Pointer contour)
68 {
70  contourInfo.contour = contour;
71  double n[3];
72  double p[3];
73  contour->GetVtkPolyData()->GetPoints()->GetPoint(0, p);
74  vtkPolygon::ComputeNormal(contour->GetVtkPolyData()->GetPoints(), n);
75  contourInfo.contourNormal = n;
76  contourInfo.contourPoint = p;
77  return contourInfo;
78 }
79 
81  : m_SelectedSegmentation(nullptr), m_CurrentTimeStep(0)
82 {
83  m_DistanceImageSpacing = 0.0;
84  m_ReduceFilter = ReduceContourSetFilter::New();
85  m_NormalsFilter = ComputeContourSetNormalsFilter::New();
86  m_InterpolateSurfaceFilter = CreateDistanceImageFromSurfaceFilter::New();
87  // m_TimeSelector = ImageTimeSelector::New();
88 
89  m_ReduceFilter->SetUseProgressBar(false);
90  // m_ReduceFilter->SetProgressStepSize(1);
91  m_NormalsFilter->SetUseProgressBar(true);
92  m_NormalsFilter->SetProgressStepSize(1);
93  m_InterpolateSurfaceFilter->SetUseProgressBar(true);
94  m_InterpolateSurfaceFilter->SetProgressStepSize(7);
95 
96  m_Contours = Surface::New();
97 
98  m_PolyData = vtkSmartPointer<vtkPolyData>::New();
99  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
100  m_PolyData->SetPoints(points);
101 
102  m_InterpolationResult = nullptr;
103  m_CurrentNumberOfReducedContours = 0;
104 }
105 
107 {
108  // Removing all observers
109  auto dataIter = m_SegmentationObserverTags.begin();
110  for (; dataIter != m_SegmentationObserverTags.end(); ++dataIter)
111  {
112  (*dataIter).first->RemoveObserver((*dataIter).second);
113  }
114  m_SegmentationObserverTags.clear();
115 }
116 
118 {
120 
121  if (m_Instance.IsNull())
122  {
124  }
125  return m_Instance;
126 }
127 
129 {
130  if (newContour->GetVtkPolyData()->GetNumberOfPoints() > 0)
131  {
133  this->AddToInterpolationPipeline(contourInfo);
134 
135  this->Modified();
136  }
137 }
138 
139 void mitk::SurfaceInterpolationController::AddNewContours(std::vector<mitk::Surface::Pointer> newContours)
140 {
141  for (unsigned int i = 0; i < newContours.size(); ++i)
142  {
143  if (newContours.at(i)->GetVtkPolyData()->GetNumberOfPoints() > 0)
144  {
145  ContourPositionInformation contourInfo = CreateContourPositionInformation(newContours.at(i));
146  this->AddToInterpolationPipeline(contourInfo);
147  }
148  }
149  this->Modified();
150 }
151 
152 void mitk::SurfaceInterpolationController::AddToInterpolationPipeline(ContourPositionInformation contourInfo)
153 {
154  if (!m_SelectedSegmentation)
155  {
156  return;
157  }
158 
159  int pos(-1);
160  unsigned int numTimeSteps = m_SelectedSegmentation->GetTimeSteps();
161  if (m_CurrentTimeStep >= numTimeSteps)
162  {
163  MITK_ERROR << "Invalid time step requested for interpolation pipeline.";
164  return;
165  }
166 
167  ContourPositionInformationVec2D currentContours = m_ListOfInterpolationSessions[m_SelectedSegmentation];
168  ContourPositionInformationList currentContourList = currentContours[m_CurrentTimeStep];
169 
170  mitk::Surface *newContour = contourInfo.contour;
171  for (unsigned int i = 0; i < currentContourList.size(); i++)
172  {
173  ContourPositionInformation contourFromList = currentContourList.at(i);
174  if (ContoursCoplanar(contourInfo, contourFromList))
175  {
176  pos = i;
177  break;
178  }
179  }
180 
181  // Don't save a new empty contour
182  if (pos == -1 && newContour->GetVtkPolyData()->GetNumberOfPoints() > 0)
183  {
184  m_ReduceFilter->SetInput(m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].size(),
185  newContour);
186  m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].push_back(contourInfo);
187  }
188  else if (pos != -1 && newContour->GetVtkPolyData()->GetNumberOfPoints() > 0)
189  {
190  m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].at(pos) = contourInfo;
191  m_ReduceFilter->SetInput(pos, newContour);
192  }
193  else if (newContour->GetVtkPolyData()->GetNumberOfPoints() == 0)
194  {
195  this->RemoveContour(contourInfo);
196  }
197 }
198 
200 {
201  if (!m_SelectedSegmentation)
202  {
203  return false;
204  }
205 
206  unsigned int numTimeSteps = m_SelectedSegmentation->GetTimeSteps();
207  if (m_CurrentTimeStep >= numTimeSteps)
208  {
209  return false;
210  }
211 
212  auto it = m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].begin();
213  while (it != m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].end())
214  {
215  ContourPositionInformation currentContour = (*it);
216  if (ContoursCoplanar(currentContour, contourInfo))
217  {
218  m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].erase(it);
219  this->ReinitializeInterpolation();
220  return true;
221  }
222  ++it;
223  }
224  return false;
225 }
226 
228 {
229  if (!m_SelectedSegmentation)
230  {
231  return nullptr;
232  }
233 
234  unsigned int numTimeSteps = m_SelectedSegmentation->GetTimeSteps();
235  if (m_CurrentTimeStep >= numTimeSteps)
236  {
237  return nullptr;
238  }
239 
240  ContourPositionInformationList contourList = m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep];
241  for (unsigned int i = 0; i < contourList.size(); ++i)
242  {
243  ContourPositionInformation currentContour = contourList.at(i);
244  if (ContoursCoplanar(contourInfo, currentContour))
245  return currentContour.contour;
246  }
247  return nullptr;
248 }
249 
251 {
252  if (!m_SelectedSegmentation)
253  {
254  return -1;
255  }
256 
257  unsigned int numTimeSteps = m_SelectedSegmentation->GetTimeSteps();
258  if (m_CurrentTimeStep >= numTimeSteps)
259  {
260  return -1;
261  }
262 
263  return m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].size();
264 }
265 
267 {
268  m_ReduceFilter->Update();
269 
270  m_CurrentNumberOfReducedContours = m_ReduceFilter->GetNumberOfOutputs();
271  if (m_CurrentNumberOfReducedContours == 1)
272  {
273  vtkPolyData *tmp = m_ReduceFilter->GetOutput(0)->GetVtkPolyData();
274  if (tmp == nullptr)
275  {
276  m_CurrentNumberOfReducedContours = 0;
277  }
278  }
279 
281  timeSelector->SetInput(m_SelectedSegmentation);
282  timeSelector->SetTimeNr(m_CurrentTimeStep);
283  timeSelector->SetChannelNr(0);
284  timeSelector->Update();
285  mitk::Image::Pointer refSegImage = timeSelector->GetOutput();
286 
287  m_NormalsFilter->SetSegmentationBinaryImage(refSegImage);
288  for (unsigned int i = 0; i < m_CurrentNumberOfReducedContours; i++)
289  {
290  mitk::Surface::Pointer reducedContour = m_ReduceFilter->GetOutput(i);
291  reducedContour->DisconnectPipeline();
292  m_NormalsFilter->SetInput(i, reducedContour);
293  m_InterpolateSurfaceFilter->SetInput(i, m_NormalsFilter->GetOutput(i));
294  }
295 
296  if (m_CurrentNumberOfReducedContours < 2)
297  {
298  // If no interpolation is possible reset the interpolation result
299  m_InterpolationResult = nullptr;
300  return;
301  }
302 
303  // Setting up progress bar
305 
306  // create a surface from the distance-image
308  imageToSurfaceFilter->SetInput(m_InterpolateSurfaceFilter->GetOutput());
309  imageToSurfaceFilter->SetThreshold(0);
310  imageToSurfaceFilter->SetSmooth(true);
311  imageToSurfaceFilter->SetSmoothIteration(20);
312  imageToSurfaceFilter->Update();
313 
314  mitk::Surface::Pointer interpolationResult = mitk::Surface::New();
315  interpolationResult->SetVtkPolyData(imageToSurfaceFilter->GetOutput()->GetVtkPolyData(), m_CurrentTimeStep);
316  m_InterpolationResult = interpolationResult;
317 
318  m_DistanceImageSpacing = m_InterpolateSurfaceFilter->GetDistanceImageSpacing();
319 
320  vtkSmartPointer<vtkAppendPolyData> polyDataAppender = vtkSmartPointer<vtkAppendPolyData>::New();
321  for (unsigned int i = 0; i < m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].size(); i++)
322  {
323  polyDataAppender->AddInputData(
324  m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].at(i).contour->GetVtkPolyData());
325  }
326  polyDataAppender->Update();
327  m_Contours->SetVtkPolyData(polyDataAppender->GetOutput());
328 
329  // Last progress step
331 
332  m_InterpolationResult->DisconnectPipeline();
333 }
334 
336 {
337  return m_InterpolationResult;
338 }
339 
341 {
342  return m_Contours;
343 }
344 
346 {
347  m_DataStorage = ds;
348 }
349 
351 {
352  m_ReduceFilter->SetMinSpacing(minSpacing);
353 }
354 
356 {
357  m_ReduceFilter->SetMaxSpacing(maxSpacing);
358  m_NormalsFilter->SetMaxSpacing(maxSpacing);
359 }
360 
362 {
363  m_InterpolateSurfaceFilter->SetDistanceImageVolume(distImgVolume);
364 }
365 
367 {
368  return m_SelectedSegmentation;
369 }
370 
372 {
373  return m_InterpolateSurfaceFilter->GetOutput();
374 }
375 
377 {
378  double numberOfPointsAfterReduction = m_ReduceFilter->GetNumberOfPointsAfterReduction() * 3;
379  double sizeOfPoints = pow(numberOfPointsAfterReduction, 2) * sizeof(double);
381  double percentage = sizeOfPoints / totalMem;
382  return percentage;
383 }
384 
386 {
387  return m_ListOfInterpolationSessions.size();
388 }
389 
390 template <typename TPixel, unsigned int VImageDimension>
391 void mitk::SurfaceInterpolationController::GetImageBase(itk::Image<TPixel, VImageDimension> *input,
393 {
394  result->Graft(input);
395 }
396 
398 {
399  this->SetCurrentInterpolationSession(segmentation);
400 }
401 
403 {
404  if (currentSegmentationImage.GetPointer() == m_SelectedSegmentation)
405  return;
406 
407  if (currentSegmentationImage.IsNull())
408  {
409  m_SelectedSegmentation = nullptr;
410  return;
411  }
412 
413  m_SelectedSegmentation = currentSegmentationImage.GetPointer();
414 
415  auto it = m_ListOfInterpolationSessions.find(currentSegmentationImage.GetPointer());
416  // If the session does not exist yet create a new ContourPositionPairList otherwise reinitialize the interpolation
417  // pipeline
418  if (it == m_ListOfInterpolationSessions.end())
419  {
421  m_ListOfInterpolationSessions.insert(
422  std::pair<mitk::Image *, ContourPositionInformationVec2D>(m_SelectedSegmentation, newList));
423  m_InterpolationResult = nullptr;
424  m_CurrentNumberOfReducedContours = 0;
425 
428  command->SetCallbackFunction(this, &SurfaceInterpolationController::OnSegmentationDeleted);
429  m_SegmentationObserverTags.insert(std::pair<mitk::Image *, unsigned long>(
430  m_SelectedSegmentation, m_SelectedSegmentation->AddObserver(itk::DeleteEvent(), command)));
431  }
432 
433  this->ReinitializeInterpolation();
434 }
435 
437  mitk::Image::Pointer newSession)
438 {
439  if (oldSession.IsNull() || newSession.IsNull())
440  return false;
441 
442  if (oldSession.GetPointer() == newSession.GetPointer())
443  return false;
444 
445  if (!mitk::Equal(*(oldSession->GetGeometry()), *(newSession->GetGeometry()), mitk::eps, false))
446  return false;
447 
448  auto it = m_ListOfInterpolationSessions.find(oldSession.GetPointer());
449 
450  if (it == m_ListOfInterpolationSessions.end())
451  return false;
452 
453  ContourPositionInformationVec2D oldList = (*it).second;
454  m_ListOfInterpolationSessions.insert(
455  std::pair<mitk::Image *, ContourPositionInformationVec2D>(newSession.GetPointer(), oldList));
458  command->SetCallbackFunction(this, &SurfaceInterpolationController::OnSegmentationDeleted);
459  m_SegmentationObserverTags.insert(
460  std::pair<mitk::Image *, unsigned long>(newSession, newSession->AddObserver(itk::DeleteEvent(), command)));
461 
462  if (m_SelectedSegmentation == oldSession)
463  m_SelectedSegmentation = newSession;
464 
466  timeSelector->SetInput(m_SelectedSegmentation);
467  timeSelector->SetTimeNr(m_CurrentTimeStep);
468  timeSelector->SetChannelNr(0);
469  timeSelector->Update();
470  mitk::Image::Pointer refSegImage = timeSelector->GetOutput();
471  m_NormalsFilter->SetSegmentationBinaryImage(refSegImage);
472 
473  this->RemoveInterpolationSession(oldSession);
474  return true;
475 }
476 
478 {
479  this->RemoveInterpolationSession(segmentation);
480 }
481 
483 {
484  if (segmentationImage)
485  {
486  if (m_SelectedSegmentation == segmentationImage)
487  {
488  m_NormalsFilter->SetSegmentationBinaryImage(nullptr);
489  m_SelectedSegmentation = nullptr;
490  }
491  m_ListOfInterpolationSessions.erase(segmentationImage);
492  // Remove observer
493  auto pos = m_SegmentationObserverTags.find(segmentationImage);
494  if (pos != m_SegmentationObserverTags.end())
495  {
496  segmentationImage->RemoveObserver((*pos).second);
497  m_SegmentationObserverTags.erase(pos);
498  }
499  }
500 }
501 
503 {
504  // Removing all observers
505  auto dataIter = m_SegmentationObserverTags.begin();
506  while (dataIter != m_SegmentationObserverTags.end())
507  {
508  mitk::Image *image = (*dataIter).first;
509  image->RemoveObserver((*dataIter).second);
510  ++dataIter;
511  }
512 
513  m_SegmentationObserverTags.clear();
514  m_SelectedSegmentation = nullptr;
515  m_ListOfInterpolationSessions.clear();
516 }
517 
519 {
520  // 1. detect coplanar contours
521  // 2. merge coplanar contours into a single surface
522  // 4. add contour to pipeline
523 
524  // Split the surface into separate polygons
525  vtkSmartPointer<vtkCellArray> existingPolys;
526  vtkSmartPointer<vtkPoints> existingPoints;
527  existingPolys = contours->GetVtkPolyData()->GetPolys();
528  existingPoints = contours->GetVtkPolyData()->GetPoints();
529  existingPolys->InitTraversal();
530 
531  vtkSmartPointer<vtkIdList> ids = vtkSmartPointer<vtkIdList>::New();
532 
533  typedef std::pair<mitk::Vector3D, mitk::Point3D> PointNormalPair;
534  std::vector<ContourPositionInformation> list;
535  std::vector<vtkSmartPointer<vtkPoints>> pointsList;
536  int count(0);
537  for (existingPolys->InitTraversal(); existingPolys->GetNextCell(ids);)
538  {
539  // Get the points
540  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
541  existingPoints->GetPoints(ids, points);
542  ++count;
543  pointsList.push_back(points);
544 
545  PointNormalPair p_n;
546  double n[3];
547  vtkPolygon::ComputeNormal(points, n);
548  p_n.first = n;
549  double p[3];
550 
551  existingPoints->GetPoint(ids->GetId(0), p);
552  p_n.second = p;
553 
555  p_info.contourNormal = n;
556  p_info.contourPoint = p;
557  list.push_back(p_info);
558  continue;
559  }
560 
561  // Detect and sort coplanar polygons
562  auto outer = list.begin();
563  std::vector<std::vector<vtkSmartPointer<vtkPoints>>> relatedPoints;
564  while (outer != list.end())
565  {
566  auto inner = outer;
567  ++inner;
568  std::vector<vtkSmartPointer<vtkPoints>> rel;
569  auto pointsIter = pointsList.begin();
570  rel.push_back((*pointsIter));
571  pointsIter = pointsList.erase(pointsIter);
572 
573  while (inner != list.end())
574  {
575  if (ContoursCoplanar((*outer), (*inner)))
576  {
577  inner = list.erase(inner);
578  rel.push_back((*pointsIter));
579  pointsIter = pointsList.erase(pointsIter);
580  }
581  else
582  {
583  ++inner;
584  ++pointsIter;
585  }
586  }
587  relatedPoints.push_back(rel);
588  ++outer;
589  }
590 
591  // Build the separate surfaces again
592  std::vector<mitk::Surface::Pointer> finalSurfaces;
593  for (unsigned int i = 0; i < relatedPoints.size(); ++i)
594  {
595  vtkSmartPointer<vtkPolyData> contourSurface = vtkSmartPointer<vtkPolyData>::New();
596  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
597  vtkSmartPointer<vtkCellArray> polygons = vtkSmartPointer<vtkCellArray>::New();
598  unsigned int pointId(0);
599  for (unsigned int j = 0; j < relatedPoints.at(i).size(); ++j)
600  {
601  unsigned int numPoints = relatedPoints.at(i).at(j)->GetNumberOfPoints();
602  vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
603  polygon->GetPointIds()->SetNumberOfIds(numPoints);
604  polygon->GetPoints()->SetNumberOfPoints(numPoints);
605  vtkSmartPointer<vtkPoints> currentPoints = relatedPoints.at(i).at(j);
606  for (unsigned k = 0; k < numPoints; ++k)
607  {
608  points->InsertPoint(pointId, currentPoints->GetPoint(k));
609  polygon->GetPointIds()->SetId(k, pointId);
610  ++pointId;
611  }
612  polygons->InsertNextCell(polygon);
613  }
614  contourSurface->SetPoints(points);
615  contourSurface->SetPolys(polygons);
616  contourSurface->BuildLinks();
618  surface->SetVtkPolyData(contourSurface);
619  finalSurfaces.push_back(surface);
620  }
621 
622  // Add detected contours to interpolation pipeline
623  this->AddNewContours(finalSurfaces);
624 }
625 
626 void mitk::SurfaceInterpolationController::OnSegmentationDeleted(const itk::Object *caller,
627  const itk::EventObject & /*event*/)
628 {
629  mitk::Image *tempImage = dynamic_cast<mitk::Image *>(const_cast<itk::Object *>(caller));
630  if (tempImage)
631  {
632  if (m_SelectedSegmentation == tempImage)
633  {
634  m_NormalsFilter->SetSegmentationBinaryImage(nullptr);
635  m_SelectedSegmentation = nullptr;
636  }
637  m_SegmentationObserverTags.erase(tempImage);
638  m_ListOfInterpolationSessions.erase(tempImage);
639  }
640 }
641 
643 {
644  // If session has changed reset the pipeline
645  m_ReduceFilter->Reset();
646  m_NormalsFilter->Reset();
647  m_InterpolateSurfaceFilter->Reset();
648 
650 
651  if (m_SelectedSegmentation)
652  {
654  timeSelector->SetInput(m_SelectedSegmentation);
655  timeSelector->SetTimeNr(m_CurrentTimeStep);
656  timeSelector->SetChannelNr(0);
657  timeSelector->Update();
658  mitk::Image::Pointer refSegImage = timeSelector->GetOutput();
659  AccessFixedDimensionByItk_1(refSegImage, GetImageBase, 3, itkImage);
660  m_InterpolateSurfaceFilter->SetReferenceImage(itkImage.GetPointer());
661 
662  unsigned int numTimeSteps = m_SelectedSegmentation->GetTimeSteps();
663  unsigned int size = m_ListOfInterpolationSessions[m_SelectedSegmentation].size();
664  if (size != numTimeSteps)
665  {
666  m_ListOfInterpolationSessions[m_SelectedSegmentation].resize(numTimeSteps);
667  }
668 
669  if (m_CurrentTimeStep < numTimeSteps)
670  {
671  unsigned int numContours = m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep].size();
672  for (unsigned int c = 0; c < numContours; ++c)
673  {
674  m_ReduceFilter->SetInput(c,
675  m_ListOfInterpolationSessions[m_SelectedSegmentation][m_CurrentTimeStep][c].contour);
676  }
677 
678  m_ReduceFilter->Update();
679 
680  m_CurrentNumberOfReducedContours = m_ReduceFilter->GetNumberOfOutputs();
681  if (m_CurrentNumberOfReducedContours == 1)
682  {
683  vtkPolyData *tmp = m_ReduceFilter->GetOutput(0)->GetVtkPolyData();
684  if (tmp == nullptr)
685  {
686  m_CurrentNumberOfReducedContours = 0;
687  }
688  }
689 
690  for (unsigned int i = 0; i < m_CurrentNumberOfReducedContours; i++)
691  {
692  m_NormalsFilter->SetInput(i, m_ReduceFilter->GetOutput(i));
693  m_InterpolateSurfaceFilter->SetInput(i, m_NormalsFilter->GetOutput(i));
694  }
695  }
696 
697  Modified();
698  }
699 }
static vcl_size_t GetTotalSizeOfPhysicalRam()
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
bool ReplaceInterpolationSession(mitk::Image::Pointer oldSession, mitk::Image::Pointer newSession)
void ReinitializeInterpolation(mitk::Surface::Pointer contours)
Reinitializes the interpolation using the provided contour data.
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
itk::SmartPointer< Self > Pointer
mitk::SurfaceInterpolationController::ContourPositionInformation CreateContourPositionInformation(mitk::Surface::Pointer contour)
const mitk::Surface * GetContour(ContourPositionInformation contourInfo)
Returns the contour for a given plane for the current selected segmenation.
std::vector< ContourPositionInformationList > ContourPositionInformationVec2D
#define MITK_ERROR
Definition: mitkLogMacros.h:24
virtual vtkPolyData * GetVtkPolyData(unsigned int t=0) const
unsigned int GetNumberOfContours()
Returns the number of available contours for the current selected segmentation.
void RemoveSegmentationFromContourList(mitk::Image *segmentation)
std::vector< ContourPositionInformation > ContourPositionInformationList
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by it...
Definition: mitkBaseData.h:346
bool ContoursCoplanar(mitk::SurfaceInterpolationController::ContourPositionInformation leftHandSide, mitk::SurfaceInterpolationController::ContourPositionInformation rightHandSide)
static ProgressBar * GetInstance()
static method to get the GUI dependent ProgressBar-instance so the methods for steps to do and progre...
void SetCurrentInterpolationSession(mitk::Image::Pointer currentSegmentationImage)
mitk::DataStorage::Pointer m_DataStorage
void GetImageBase(itk::Image< TPixel, VImageDimension > *input, itk::ImageBase< 3 >::Pointer &result)
Image class for storing images.
Definition: mitkImage.h:76
mitk::Image::Pointer GetCurrentSegmentation()
Get the current selected segmentation for which the interpolation is performed.
void AddNewContours(std::vector< Surface::Pointer > newContours)
Adds new extracted contours to the list. If one or more contours at a given position already exist th...
bool RemoveContour(ContourPositionInformation contourInfo)
Removes the contour for a given plane for the current selected segmenation.
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
#define AccessFixedDimensionByItk_1(mitkImage, itkImageTypeFunction, dimension, arg1)
static SurfaceInterpolationController * GetInstance()
MITKCORE_EXPORT const ScalarType eps
void AddNewContour(Surface::Pointer newContour)
Adds a new extracted contour to the list.
void SetDistanceImageVolume(unsigned int distImageVolume)
static Pointer New()
void RemoveInterpolationSession(mitk::Image::Pointer segmentationImage)
Remove interpolation session.
static Pointer New()
void SetCurrentSegmentationInterpolationList(mitk::Image::Pointer segmentation)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.