42 #include <itkCommand.h> 47 #include <QMessageBox> 48 #include <QPushButton> 49 #include <QVBoxLayout> 51 #include <vtkPolyVertex.h> 52 #include <vtkUnstructuredGrid.h> 60 std::map<QAction *, mitk::SliceNavigationController *> actionToSliceDimension;
66 return actionToSliceDimension;
72 m_Interpolator(
mitk::SegmentationInterpolationController::New()),
73 m_SurfaceInterpolator(
mitk::SurfaceInterpolationController::GetInstance()),
74 m_ToolManager(nullptr),
78 m_2DInterpolationEnabled(false),
79 m_3DInterpolationEnabled(false),
82 m_GroupBoxEnableExclusiveInterpolationMode =
new QGroupBox(
"Interpolation",
this);
84 QVBoxLayout *vboxLayout =
new QVBoxLayout(m_GroupBoxEnableExclusiveInterpolationMode);
89 m_CmbInterpolation =
new QComboBox(m_GroupBoxEnableExclusiveInterpolationMode);
90 m_CmbInterpolation->addItem(
"Disabled");
91 m_CmbInterpolation->addItem(
"2-Dimensional");
92 m_CmbInterpolation->addItem(
"3-Dimensional");
93 vboxLayout->addWidget(m_CmbInterpolation);
95 m_BtnApply2D =
new QPushButton(
"Confirm for single slice", m_GroupBoxEnableExclusiveInterpolationMode);
96 vboxLayout->addWidget(m_BtnApply2D);
98 m_BtnApplyForAllSlices2D =
new QPushButton(
"Confirm for all slices", m_GroupBoxEnableExclusiveInterpolationMode);
99 vboxLayout->addWidget(m_BtnApplyForAllSlices2D);
101 m_BtnApply3D =
new QPushButton(
"Confirm", m_GroupBoxEnableExclusiveInterpolationMode);
102 vboxLayout->addWidget(m_BtnApply3D);
104 m_BtnSuggestPlane =
new QPushButton(
"Suggest a plane", m_GroupBoxEnableExclusiveInterpolationMode);
105 vboxLayout->addWidget(m_BtnSuggestPlane);
107 m_BtnReinit3DInterpolation =
new QPushButton(
"Reinit Interpolation", m_GroupBoxEnableExclusiveInterpolationMode);
108 vboxLayout->addWidget(m_BtnReinit3DInterpolation);
110 m_ChkShowPositionNodes =
new QCheckBox(
"Show Position Nodes", m_GroupBoxEnableExclusiveInterpolationMode);
111 vboxLayout->addWidget(m_ChkShowPositionNodes);
113 this->HideAllInterpolationControls();
123 connect(m_ChkShowPositionNodes, SIGNAL(toggled(
bool)),
this, SLOT(
OnShowMarkers(
bool)));
126 QHBoxLayout *layout =
new QHBoxLayout(
this);
127 layout->addWidget(m_GroupBoxEnableExclusiveInterpolationMode);
128 this->setLayout(layout);
130 itk::ReceptorMemberCommand<QmitkSlicesInterpolator>::Pointer command =
131 itk::ReceptorMemberCommand<QmitkSlicesInterpolator>::New();
133 InterpolationInfoChangedObserverTag = m_Interpolator->AddObserver(itk::ModifiedEvent(), command);
135 itk::ReceptorMemberCommand<QmitkSlicesInterpolator>::Pointer command2 =
136 itk::ReceptorMemberCommand<QmitkSlicesInterpolator>::New();
138 SurfaceInterpolationInfoChangedObserverTag = m_SurfaceInterpolator->AddObserver(itk::ModifiedEvent(), command2);
161 m_InterpolatedSurfaceNode->SetVisibility(
false);
171 m_3DContourNode->SetVisibility(
173 m_3DContourNode->SetVisibility(
175 m_3DContourNode->SetVisibility(
177 m_3DContourNode->SetVisibility(
180 QWidget::setContentsMargins(0, 0, 0, 0);
181 if (QWidget::layout() !=
nullptr)
183 QWidget::layout()->setContentsMargins(0, 0, 0, 0);
192 m_Timer =
new QTimer(
this);
198 if (m_DataStorage == storage)
203 if (m_DataStorage.IsNotNull())
205 m_DataStorage->RemoveNodeEvent.RemoveListener(
210 m_DataStorage = storage;
211 m_SurfaceInterpolator->SetDataStorage(storage);
213 if (m_DataStorage.IsNotNull())
215 m_DataStorage->RemoveNodeEvent.AddListener(
223 if (m_DataStorage.IsNotNull())
225 return m_DataStorage;
234 const QList<mitk::SliceNavigationController *> &controllers)
236 Q_ASSERT(!controllers.empty());
244 m_ToolManager = toolManager;
250 QWidget::setEnabled(node !=
nullptr);
253 m_ToolManager->WorkingDataChanged +=
265 itk::MemberCommand<QmitkSlicesInterpolator>::Pointer deleteCommand =
266 itk::MemberCommand<QmitkSlicesInterpolator>::New();
268 m_ControllerToDeleteObserverTag.insert(slicer, slicer->AddObserver(itk::DeleteEvent(), deleteCommand));
270 itk::MemberCommand<QmitkSlicesInterpolator>::Pointer timeChangedCommand =
271 itk::MemberCommand<QmitkSlicesInterpolator>::New();
273 m_ControllerToTimeObserverTag.insert(
276 itk::MemberCommand<QmitkSlicesInterpolator>::Pointer sliceChangedCommand =
277 itk::MemberCommand<QmitkSlicesInterpolator>::New();
279 m_ControllerToSliceObserverTag.insert(
285 m_Initialized =
true;
290 if (m_ToolManager.IsNotNull())
292 m_ToolManager->WorkingDataChanged -=
300 slicer->RemoveObserver(m_ControllerToDeleteObserverTag.take(slicer));
301 slicer->RemoveObserver(m_ControllerToTimeObserverTag.take(slicer));
302 slicer->RemoveObserver(m_ControllerToSliceObserverTag.take(slicer));
307 m_ToolManager =
nullptr;
309 m_Initialized =
false;
322 if (m_DataStorage.IsNotNull())
324 m_DataStorage->RemoveNodeEvent.RemoveListener(
327 if (m_DataStorage->Exists(m_3DContourNode))
328 m_DataStorage->Remove(m_3DContourNode);
329 if (m_DataStorage->Exists(m_InterpolatedSurfaceNode))
330 m_DataStorage->Remove(m_InterpolatedSurfaceNode);
334 m_Interpolator->RemoveObserver(InterpolationInfoChangedObserverTag);
335 m_SurfaceInterpolator->RemoveObserver(SurfaceInterpolationInfoChangedObserverTag);
345 QWidget::setEnabled(enable);
350 if (m_2DInterpolationEnabled)
352 this->Show2DInterpolationControls(
true);
353 m_Interpolator->Activate2DInterpolation(
true);
355 else if (m_3DInterpolationEnabled)
357 this->Show3DInterpolationControls(
true);
364 this->HideAllInterpolationControls();
372 m_Interpolator->Activate2DInterpolation(status);
390 void QmitkSlicesInterpolator::HideAllInterpolationControls()
392 this->Show2DInterpolationControls(
false);
393 this->Show3DInterpolationControls(
false);
396 void QmitkSlicesInterpolator::Show2DInterpolationControls(
bool show)
398 m_BtnApply2D->setVisible(show);
399 m_BtnApplyForAllSlices2D->setVisible(show);
402 void QmitkSlicesInterpolator::Show3DInterpolationControls(
bool show)
404 m_BtnApply3D->setVisible(show);
405 m_BtnSuggestPlane->setVisible(show);
406 m_ChkShowPositionNodes->setVisible(show);
407 m_BtnReinit3DInterpolation->setVisible(show);
415 m_GroupBoxEnableExclusiveInterpolationMode->setTitle(
"Interpolation");
416 this->HideAllInterpolationControls();
420 m_Interpolator->Activate2DInterpolation(
false);
424 m_GroupBoxEnableExclusiveInterpolationMode->setTitle(
"Interpolation (Enabled)");
425 this->HideAllInterpolationControls();
426 this->Show2DInterpolationControls(
true);
429 m_Interpolator->Activate2DInterpolation(
true);
433 m_GroupBoxEnableExclusiveInterpolationMode->setTitle(
"Interpolation (Enabled)");
434 this->HideAllInterpolationControls();
435 this->Show3DInterpolationControls(
true);
438 m_Interpolator->Activate2DInterpolation(
false);
442 MITK_ERROR <<
"Unknown interpolation method!";
443 m_CmbInterpolation->setCurrentIndex(0);
450 mitk::DataStorage::SetOfObjects::ConstPointer allContourMarkers =
453 for (mitk::DataStorage::SetOfObjects::ConstIterator it = allContourMarkers->Begin(); it != allContourMarkers->End();
462 if (m_ToolManager->GetWorkingData(0) !=
nullptr)
464 m_Segmentation =
dynamic_cast<mitk::Image *
>(m_ToolManager->GetWorkingData(0)->GetData());
465 m_BtnReinit3DInterpolation->setEnabled(
true);
471 m_FeedbackNode->SetData(
nullptr);
473 m_3DContourNode->SetData(
nullptr);
475 m_InterpolatedSurfaceNode->SetData(
nullptr);
476 m_BtnReinit3DInterpolation->setEnabled(
false);
482 if (m_2DInterpolationEnabled)
486 this->CheckSupportedImageDimension();
496 if (!dynamic_cast<const mitk::SliceNavigationController::GeometryTimeEvent *>(&e))
504 m_SurfaceInterpolator->SetCurrentTimeStep(slicer->
GetTime()->
GetPos());
506 if (m_LastSNC == slicer)
515 if (!dynamic_cast<const mitk::SliceNavigationController::GeometrySliceEvent *>(&e))
529 if (!m_2DInterpolationEnabled)
538 if (tsg && m_TimeStep.contains(slicer))
553 catch (
const std::bad_cast &)
562 unsigned int timeStep,
573 int clickedSliceDimension(-1);
574 int clickedSliceIndex(-1);
580 m_Interpolator->Interpolate(clickedSliceDimension, clickedSliceIndex, plane, timeStep);
581 m_FeedbackNode->SetData(interpolation);
584 m_LastSliceIndex = clickedSliceIndex;
595 if (interpolatedSurface.IsNotNull() && workingNode &&
599 m_BtnApply3D->setEnabled(
true);
600 m_BtnSuggestPlane->setEnabled(
true);
601 m_InterpolatedSurfaceNode->SetData(interpolatedSurface);
602 m_3DContourNode->SetData(m_SurfaceInterpolator->GetContoursAsSurface());
606 if (!m_DataStorage->Exists(m_InterpolatedSurfaceNode))
608 m_DataStorage->Add(m_InterpolatedSurfaceNode);
610 if (!m_DataStorage->Exists(m_3DContourNode))
612 m_DataStorage->Add(m_3DContourNode, workingNode);
615 else if (interpolatedSurface.IsNull())
617 m_BtnApply3D->setEnabled(
false);
618 m_BtnSuggestPlane->setEnabled(
false);
620 if (m_DataStorage->Exists(m_InterpolatedSurfaceNode))
626 m_BtnReinit3DInterpolation->setEnabled(
true);
636 if (m_Segmentation && m_FeedbackNode->GetData())
640 vtkSmartPointer<mitkVtkImageOverwrite> reslice = vtkSmartPointer<mitkVtkImageOverwrite>::New();
644 reslice->SetInputSlice(slice->GetSliceData()->GetVtkImageAccessor(slice)->GetVtkImageData());
646 reslice->SetOverwriteMode(
true);
650 extractor->SetInput(m_Segmentation);
652 extractor->SetTimeStep(timestep);
654 extractor->SetVtkOutputRequest(
true);
657 extractor->Modified();
661 m_Segmentation->Modified();
664 m_FeedbackNode->SetData(
nullptr);
684 timeSelector->SetInput(m_Segmentation);
685 timeSelector->SetTimeNr(timeStep);
686 timeSelector->Update();
687 image3D = timeSelector->GetOutput();
691 diffImage->Initialize(image3D);
699 mitk::PixelType pixelType(mitk::MakeScalarPixelType<mitk::Tool::DefaultSegmentationDataType>());
702 if (m_Segmentation->
GetImageDescriptor()->GetChannelDescriptor().GetPixelType().GetComponentType() ==
703 itk::ImageIOBase::UCHAR)
705 pixelType = mitk::MakeScalarPixelType<unsigned char>();
710 (pixelType.
GetBpe() >> 3) * diffImage->GetDimension(0) * diffImage->GetDimension(1) *
711 diffImage->GetDimension(2));
717 int sliceDimension(-1);
721 unsigned int zslices = m_Segmentation->
GetDimension(sliceDimension);
725 unsigned int totalChangedSlices(0);
727 for (
unsigned int sliceIndex = 0; sliceIndex < zslices; ++sliceIndex)
732 origin[sliceDimension] = sliceIndex;
734 reslicePlane->SetOrigin(origin);
737 m_Interpolator->Interpolate(sliceDimension, sliceIndex, reslicePlane, timeStep);
739 if (interpolation.IsNotNull())
743 vtkSmartPointer<mitkVtkImageOverwrite> reslice = vtkSmartPointer<mitkVtkImageOverwrite>::New();
746 reslice->SetInputSlice(interpolation->GetSliceData()->GetVtkImageAccessor(interpolation)->GetVtkImageData());
747 reslice->SetOverwriteMode(
true);
751 diffslicewriter->SetInput(diffImage);
752 diffslicewriter->SetTimeStep(0);
753 diffslicewriter->SetWorldGeometry(reslicePlane);
754 diffslicewriter->SetVtkOutputRequest(
true);
755 diffslicewriter->SetResliceTransformByGeometry(diffImage->GetTimeGeometry()->GetGeometryForTimeStep(0));
757 diffslicewriter->Modified();
758 diffslicewriter->Update();
759 ++totalChangedSlices;
765 if (totalChangedSlices > 0)
776 std::stringstream comment;
777 comment <<
"Confirm all interpolations (" << totalChangedSlices <<
")";
789 m_FeedbackNode->SetData(
nullptr);
798 if (slicer ==
nullptr)
806 QMenu orientationPopup(
this);
807 std::map<QAction *, mitk::SliceNavigationController *>::const_iterator it;
809 orientationPopup.addAction(it->first);
813 orientationPopup.exec(QCursor::pos());
818 if (m_InterpolatedSurfaceNode.IsNotNull() && m_InterpolatedSurfaceNode->GetData())
820 mitk::DataNode *segmentationNode = m_ToolManager->GetWorkingData(0);
824 s2iFilter->MakeOutputBinaryOn();
826 s2iFilter->SetUShortBinaryPixelType(
true);
827 s2iFilter->SetInput(dynamic_cast<mitk::Surface *>(m_InterpolatedSurfaceNode->GetData()));
830 if (m_ToolManager->GetReferenceData(0) ==
nullptr || m_ToolManager->GetWorkingData(0) ==
nullptr)
834 s2iFilter->SetImage(dynamic_cast<mitk::Image *>(m_ToolManager->GetReferenceData(0)->GetData()));
841 const void *cPointer = readAccess.
GetData();
843 if (currSeg && cPointer)
845 currSeg->
SetVolume(cPointer, timestep, 0);
852 m_CmbInterpolation->setCurrentIndex(0);
857 segSurface->SetColor(rgb);
858 segSurface->SetData(m_InterpolatedSurfaceNode->GetData());
859 std::stringstream stream;
860 stream << segmentationNode->
GetName();
862 stream <<
"3D-interpolation";
863 segSurface->SetName(stream.str());
867 segSurface->SetVisibility(
false);
868 m_DataStorage->Add(segSurface, segmentationNode);
873 void ::QmitkSlicesInterpolator::OnSuggestPlaneClicked()
875 if (m_PlaneWatcher.isRunning())
876 m_PlaneWatcher.waitForFinished();
878 m_PlaneWatcher.setFuture(m_PlaneFuture);
881 void ::QmitkSlicesInterpolator::RunPlaneSuggestion()
888 m_EdgeDetector->SetSegmentationMask(m_Segmentation);
889 m_EdgeDetector->SetInput(dynamic_cast<mitk::Image *>(m_ToolManager->GetReferenceData(0)->GetData()));
890 m_EdgeDetector->Update();
893 uGrid->SetVtkUnstructuredGrid(m_EdgeDetector->GetOutput()->GetVtkUnstructuredGrid());
899 vtkSmartPointer<vtkPolyData> vtkpoly = surface->GetVtkPolyData();
900 vtkSmartPointer<vtkPoints> vtkpoints = vtkpoly->GetPoints();
902 vtkSmartPointer<vtkUnstructuredGrid> vGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
903 vtkSmartPointer<vtkPolyVertex> verts = vtkSmartPointer<vtkPolyVertex>::New();
905 verts->GetPointIds()->SetNumberOfIds(vtkpoints->GetNumberOfPoints());
906 for (
int i = 0; i < vtkpoints->GetNumberOfPoints(); i++)
908 verts->GetPointIds()->SetId(i, i);
912 vGrid->InsertNextCell(verts->GetCellType(), verts->GetPointIds());
913 vGrid->SetPoints(vtkpoints);
916 interpolationGrid->SetVtkUnstructuredGrid(vGrid);
918 m_PointScorer->SetInput(0, uGrid);
919 m_PointScorer->SetInput(1, interpolationGrid);
920 m_PointScorer->Update();
923 scoredGrid = m_PointScorer->GetOutput();
929 clusterFilter->SetInput(scoredGrid);
930 clusterFilter->SetMeshing(
false);
931 clusterFilter->SetMinPts(4);
932 clusterFilter->Seteps(spacing);
933 clusterFilter->Update();
941 std::vector<mitk::UnstructuredGrid::Pointer> grids = clusterFilter->GetAllClusters();
965 mitk::DataStorage::SetOfObjects::ConstPointer contourNodes =
966 m_DataStorage->GetDerivations(m_ToolManager->GetWorkingData(0), pred);
968 if (contourNodes->Size() != 0)
970 m_BtnApply3D->setEnabled(
true);
971 m_3DContourNode = contourNodes->at(0);
975 m_BtnReinit3DInterpolation->setEnabled(
false);
979 m_BtnApply3D->setEnabled(
false);
980 QMessageBox errorInfo;
981 errorInfo.setWindowTitle(
"Reinitialize surface interpolation");
982 errorInfo.setIcon(QMessageBox::Information);
983 errorInfo.setText(
"No contours available for the selected segmentation!");
992 std::map<QAction *, mitk::SliceNavigationController *>::const_iterator iter =
ACTION_TO_SLICEDIMENSION.find(action);
1002 QMessageBox errorInfo;
1003 errorInfo.setWindowTitle(
"Interpolation Process");
1004 errorInfo.setIcon(QMessageBox::Critical);
1005 errorInfo.setText(
"An error occurred during interpolation. Possible cause: Not enough memory!");
1009 std::cerr <<
"Ill construction in " __FILE__
" l. " << __LINE__ << std::endl;
1015 m_2DInterpolationEnabled = on;
1019 if (m_DataStorage.IsNotNull())
1021 if (on && !m_DataStorage->Exists(m_FeedbackNode))
1023 m_DataStorage->Add(m_FeedbackNode);
1035 mitk::DataNode *referenceNode = m_ToolManager->GetReferenceData(0);
1036 QWidget::setEnabled(workingNode !=
nullptr);
1038 m_BtnApply2D->setEnabled(on);
1039 m_FeedbackNode->SetVisibility(on);
1052 m_Interpolator->SetSegmentationVolume(segmentation);
1057 m_Interpolator->SetReferenceVolume(referenceImage);
1068 m_SurfaceInterpolator->Interpolate();
1073 m_Timer->start(500);
1086 float currentColor[3];
1087 m_InterpolatedSurfaceNode->GetColor(currentColor);
1097 m_InterpolatedSurfaceNode->Update();
1104 m_3DInterpolationEnabled = on;
1106 this->CheckSupportedImageDimension();
1109 if (m_DataStorage.IsNotNull() && m_ToolManager && m_3DInterpolationEnabled)
1115 bool isInterpolationResult(
false);
1116 workingNode->
GetBoolProperty(
"3DInterpolationResult", isInterpolationResult);
1120 mitk::DataStorage::SetOfObjects::ConstPointer interpolationResults =
1121 m_DataStorage->GetDerivations(workingNode, pred);
1123 for (
unsigned int i = 0; i < interpolationResults->Size(); ++i)
1126 if (currNode.IsNotNull())
1127 m_DataStorage->Remove(currNode);
1132 !isInterpolationResult && m_3DInterpolationEnabled)
1134 int ret = QMessageBox::Yes;
1136 if (m_SurfaceInterpolator->EstimatePortionOfNeededMemory() > 0.5)
1139 msgBox.setText(
"Due to short handed system memory the 3D interpolation may be very slow!");
1140 msgBox.setInformativeText(
"Are you sure you want to activate the 3D interpolation?");
1141 msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
1142 ret = msgBox.exec();
1145 if (m_Watcher.isRunning())
1146 m_Watcher.waitForFinished();
1148 if (ret == QMessageBox::Yes)
1151 m_Watcher.setFuture(m_Future);
1155 m_CmbInterpolation->setCurrentIndex(0);
1158 else if (!m_3DInterpolationEnabled)
1161 m_BtnApply3D->setEnabled(m_3DInterpolationEnabled);
1162 m_BtnSuggestPlane->setEnabled(m_3DInterpolationEnabled);
1167 QWidget::setEnabled(
false);
1168 m_ChkShowPositionNodes->setEnabled(m_3DInterpolationEnabled);
1171 if (!m_3DInterpolationEnabled)
1174 m_BtnApply3D->setEnabled(m_3DInterpolationEnabled);
1175 m_BtnSuggestPlane->setEnabled(m_3DInterpolationEnabled);
1180 MITK_ERROR <<
"Error with 3D surface interpolation!";
1212 if (m_3DInterpolationEnabled)
1214 if (m_Watcher.isRunning())
1215 m_Watcher.waitForFinished();
1217 m_Watcher.setFuture(m_Future);
1226 if (m_DataStorage.IsNotNull() && m_ToolManager && m_LastSNC)
1232 bool isInterpolationResult(
false);
1233 workingNode->
GetBoolProperty(
"3DInterpolationResult", isInterpolationResult);
1235 if (!isInterpolationResult)
1237 QWidget::setEnabled(
true);
1240 unsigned int time_position = 0;
1241 if (m_LastSNC->
GetTime() !=
nullptr)
1245 double minSpacing(100);
1246 double maxSpacing(0);
1247 for (
int i = 0; i < 3; i++)
1249 if (spacing[i] < minSpacing)
1251 minSpacing = spacing[i];
1253 if (spacing[i] > maxSpacing)
1255 maxSpacing = spacing[i];
1259 m_SurfaceInterpolator->SetMaxSpacing(maxSpacing);
1260 m_SurfaceInterpolator->SetMinSpacing(minSpacing);
1261 m_SurfaceInterpolator->SetDistanceImageVolume(50000);
1266 m_SurfaceInterpolator->SetCurrentInterpolationSession(segmentationImage);
1267 m_SurfaceInterpolator->SetCurrentTimeStep(time_position);
1272 if (m_3DInterpolationEnabled)
1274 if (m_Watcher.isRunning())
1275 m_Watcher.waitForFinished();
1277 m_Watcher.setFuture(m_Future);
1283 QWidget::setEnabled(
false);
1290 if (m_InterpolatedSurfaceNode.IsNotNull())
1291 m_InterpolatedSurfaceNode->SetVisibility(status);
1293 if (m_3DContourNode.IsNotNull())
1294 m_3DContourNode->SetVisibility(
1300 void QmitkSlicesInterpolator::CheckSupportedImageDimension()
1302 if (m_ToolManager->GetWorkingData(0))
1303 m_Segmentation = dynamic_cast<mitk::Image *>(m_ToolManager->GetWorkingData(0)->GetData());
1317 const itk::EventObject & )
1324 m_ControllerToTimeObserverTag.remove(slicer);
1325 m_ControllerToSliceObserverTag.remove(slicer);
1326 m_ControllerToDeleteObserverTag.remove(slicer);
1330 void QmitkSlicesInterpolator::WaitForFutures()
1332 if (m_Watcher.isRunning())
1334 m_Watcher.waitForFinished();
1337 if (m_PlaneWatcher.isRunning())
1339 m_PlaneWatcher.waitForFinished();
1343 void QmitkSlicesInterpolator::NodeRemoved(
const mitk::DataNode* node)
1345 if ((m_ToolManager && m_ToolManager->GetWorkingData(0) == node) ||
1346 node == m_3DContourNode ||
1347 node == m_FeedbackNode ||
1348 node == m_InterpolatedSurfaceNode)
QmitkSlicesInterpolator(QWidget *parent=nullptr, const char *name=nullptr)
void Progress(unsigned int steps=1)
Sets the current amount of progress to current progress + steps.
void ReinitializeInterpolation(mitk::Surface::Pointer contours)
Reinitializes the interpolation using the provided contour data.
void SetCurrentContourListID()
Operation, that holds information about some image difference.
Class for storing surfaces (vtkPolyData).
void OnAcceptAllPopupActivated(QAction *action)
void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)...
virtual double GetDistanceImageSpacing()
void OnSurfaceInterpolationFinished()
Data management class that handles 'was created by' relations.
const std::map< QAction *, mitk::SliceNavigationController * > createActionToSliceDimension()
void OnInterpolationMethodChanged(int index)
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
static vtkRenderWindow * GetRenderWindowByName(const std::string &name)
void OnAcceptAllInterpolationsClicked()
const mitk::PixelType GetPixelType(int n=0) const
Returns the PixelType of channel n.
float SURFACE_COLOR_RGB[3]
void Initialize(mitk::ToolManager *toolManager, const QList< mitk::SliceNavigationController *> &controllers)
static Pointer GetInstance()
void OnSliceChanged(itk::Object *sender, const itk::EventObject &)
void OnInterpolationInfoChanged(const itk::EventObject &)
DataCollection - Class to facilitate loading/accessing structured data.
virtual vtkImageData * GetVtkImageData(int t=0, int n=0)
Get a volume at a specific time t of channel n as a vtkImageData.
void * GetData()
Gives full data access.
Constants for most interaction classes, due to the generic StateMachines.
void UpdateVisibleSuggestion()
void RunPlaneSuggestion()
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer=nullptr) const
Convenience access method for bool properties (instances of BoolProperty)
static ProgressBar * GetInstance()
static method to get the GUI dependent ProgressBar-instance so the methods for steps to do and progre...
void OnInterpolationActivated(bool)
void OnSuggestPlaneClicked()
Controls the selection of the slice the associated BaseRenderer will display.
virtual mitk::PlaneGeometry * GetPlaneGeometry(int s) const
Returns the PlaneGeometry of the slice (s).
void SignalShowMarkerNodes(bool)
void OnAccept3DInterpolationClicked()
vcl_size_t GetBpe() const
Get the number of bits per element (of an element)
virtual bool SetVolume(const void *data, int t=0, int n=0)
Set data as volume at time t in channel n. It is in the responsibility of the caller to ensure that t...
void AcceptAllInterpolations(mitk::SliceNavigationController *slicer)
The LevelWindow class Class to store level/window values.
int GetComponentType() const
Get the component type (the scalar (!) type). Each element may contain m_NumberOfComponents (more tha...
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
virtual void SendSlice()
Send the currently selected slice to the connected observers (renderers)
void SetUseDistances(bool)
If true, the three clusters with the biggest mean distances are used for plane proposal Required the ...
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void FinishInterpolation(mitk::SliceNavigationController *slicer=nullptr)
mitk::DataStorage * GetDataStorage()
virtual void setEnabled(bool)
bool IsVisible(const mitk::BaseRenderer *renderer, const char *propertyKey="visible", bool defaultIsOn=true) const
Convenience access method for visibility properties (instances of BoolProperty). Return value is the ...
static DiffImageApplier * GetInstanceForUndo()
unsigned int GetDimension() const
Get dimension of the image.
void OnAcceptInterpolationClicked()
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="color") const
Convenience access method for color properties (instances of ColorProperty)
const char * GetViewDirectionAsString() const
void ChangeSurfaceColor()
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
void StartUpdateInterpolationTimer()
static RenderingManager * GetInstance()
void CreatePlaneInfo()
Creates the actual plane proposal.
Image class for storing images.
const mitk::PlaneGeometry * GetCurrentPlaneGeometry()
Returns the currently selected Plane in the current BaseGeometry (if existent).
SlicedGeometry3D * GetSlicedGeometry(unsigned int t=0) const
Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it)...
bool TranslateAndInterpolateChangedSlice(const itk::EventObject &e, mitk::SliceNavigationController *slicer)
std::map< QAction *, mitk::SliceNavigationController * > ACTION_TO_SLICEDIMENSION
void OnTimeChanged(itk::Object *sender, const itk::EventObject &)
void On2DInterpolationEnabled(bool)
static Pointer New(const char *_arg)
void SetSliceNavigationController(itk::SmartPointer< mitk::SliceNavigationController > &snc)
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
Convert world coordinates (in mm) of a point to (continuous!) index coordinates.
Describes the geometry of a data object consisting of slices.
void ExecuteOperation(Operation *operation) override
void OnInterpolationDisabled(bool)
static Pointer New(const char *_arg)
virtual void Remove(const DataNode *node)=0
Removes node from the DataStorage.
void RequestUpdate(vtkRenderWindow *renderWindow)
void SetDataStorage(mitk::DataStorage::Pointer storage)
void AddStepsToDo(unsigned int steps)
Adds steps to totalSteps.
The PlaneProposer creates a new plane based on an input point cloud.
void OnReinit3DInterpolation()
const mitk::Vector3D GetSpacing() const
Get the spacing (size of a pixel).
void OnSurfaceInterpolationInfoChanged(const itk::EventObject &)
~QmitkSlicesInterpolator() override
void OnToolManagerReferenceDataModified()
static SurfaceInterpolationController * GetInstance()
void EnableInterpolation(bool)
virtual BaseGeometry::Pointer GetGeometryForTimeStep(TimeStepType timeStep) const =0
Returns the geometry which corresponds to the given time step.
virtual bool SetOperationEvent(UndoStackItem *stackItem)=0
static UndoModel * GetCurrentUndoModel()
gives access to the currently used UndoModel Introduced to access special functions of more specific ...
void On3DInterpolationActivated(bool)
void SetFactor(double factor)
void Enable3DInterpolation(bool)
void OnToolManagerWorkingDataModified()
mitk::Stepper * GetTime()
Get the Stepper through the time.
virtual unsigned int GetPos() const
ImageWriteAccessor class to get locked write-access for a particular image part.
Describes a two-dimensional, rectangular plane.
static void IncCurrObjectEventId()
Increases the current ObjectEventId For example if a button click generates operations the ObjectEven...
void Run3DInterpolation()
void Show3DInterpolationResult(bool)
Set the visibility of the 3d interpolation.
ImageDescriptor::Pointer GetImageDescriptor() const
BaseRenderer * GetRenderer() const
Gets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used ...
void StopUpdateInterpolationTimer()
ImageReadAccessor class to get locked read access for a particular image part.
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
void Interpolate(mitk::PlaneGeometry *plane, unsigned int timeStep, mitk::SliceNavigationController *slicer)
static void IncCurrGroupEventId()
Increases the current GroupEventId For example if a button click generates operations the GroupEventI...
void OnSliceNavigationControllerDeleted(const itk::Object *sender, const itk::EventObject &)
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
Represents a pair of operations: undo and the according redo.
const void * GetData() const
Gives const access to the data.
void SetUnstructuredGrids(std::vector< itk::SmartPointer< mitk::UnstructuredGrid >> &grids)
Class for nodes of the DataTree.
Class for defining the data type of pixels.
bool GetName(std::string &nodeName, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="name") const
Convenience access method for accessing the name of an object (instance of StringProperty with proper...
void On3DInterpolationEnabled(bool)