diff --git a/Modules/Segmentation/Interactions/mitkAddContourTool.cpp b/Modules/Segmentation/Interactions/mitkAddContourTool.cpp index 0526c5fec6..6b74b472cc 100644 --- a/Modules/Segmentation/Interactions/mitkAddContourTool.cpp +++ b/Modules/Segmentation/Interactions/mitkAddContourTool.cpp @@ -1,58 +1,58 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkAddContourTool.h" #include "mitkAddContourTool.xpm" // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, AddContourTool, "Add tool"); } mitk::AddContourTool::AddContourTool() : ContourTool(1) { } mitk::AddContourTool::~AddContourTool() { } const char **mitk::AddContourTool::GetXPM() const { return mitkAddContourTool_xpm; } us::ModuleResource mitk::AddContourTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Add_48x48.png"); + us::ModuleResource resource = module->GetResource("Add.svg"); return resource; } us::ModuleResource mitk::AddContourTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Add_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Add_Cursor.svg"); return resource; } const char *mitk::AddContourTool::GetName() const { return "Add"; } diff --git a/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.cpp b/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.cpp index eb65387552..21aa9c0a22 100644 --- a/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.cpp +++ b/Modules/Segmentation/Interactions/mitkBinaryThresholdTool.cpp @@ -1,55 +1,55 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkBinaryThresholdTool.h" // us #include "usGetModuleContext.h" #include "usModule.h" #include "usModuleResource.h" namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, BinaryThresholdTool, "Thresholding tool"); } mitk::BinaryThresholdTool::BinaryThresholdTool() : BinaryThresholdBaseTool() { LockedUpperThresholdOn(); } mitk::BinaryThresholdTool::~BinaryThresholdTool() { } const char **mitk::BinaryThresholdTool::GetXPM() const { return nullptr; } us::ModuleResource mitk::BinaryThresholdTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Threshold_48x48.png"); + us::ModuleResource resource = module->GetResource("Threshold.svg"); return resource; } const char *mitk::BinaryThresholdTool::GetName() const { return "Threshold"; } void mitk::BinaryThresholdTool::SetThresholdValue(double value) { this->SetThresholdValues(value, this->GetSensibleMaximumThreshold()); } diff --git a/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.cpp b/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.cpp index 7e729be00e..eb81cdf160 100644 --- a/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.cpp +++ b/Modules/Segmentation/Interactions/mitkBinaryThresholdULTool.cpp @@ -1,50 +1,50 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkBinaryThresholdULTool.h" // us #include "usGetModuleContext.h" #include "usModule.h" #include "usModuleContext.h" #include "usModuleResource.h" namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, BinaryThresholdULTool, "ThresholdingUL tool"); } mitk::BinaryThresholdULTool::BinaryThresholdULTool() : BinaryThresholdBaseTool() { } mitk::BinaryThresholdULTool::~BinaryThresholdULTool() { } const char **mitk::BinaryThresholdULTool::GetXPM() const { return nullptr; } us::ModuleResource mitk::BinaryThresholdULTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("TwoThresholds_48x48.png"); + us::ModuleResource resource = module->GetResource("ULThreshold.svg"); return resource; } const char *mitk::BinaryThresholdULTool::GetName() const { return "UL Threshold"; } diff --git a/Modules/Segmentation/Interactions/mitkCloseRegionTool.cpp b/Modules/Segmentation/Interactions/mitkCloseRegionTool.cpp index 4e5cd15b69..1c173b24be 100644 --- a/Modules/Segmentation/Interactions/mitkCloseRegionTool.cpp +++ b/Modules/Segmentation/Interactions/mitkCloseRegionTool.cpp @@ -1,120 +1,120 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkCloseRegionTool.h" // us #include #include #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, CloseRegionTool, "Close tool"); } const char **mitk::CloseRegionTool::GetXPM() const { return nullptr; } us::ModuleResource mitk::CloseRegionTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Close_48x48.png"); + us::ModuleResource resource = module->GetResource("Close.svg"); return resource; } us::ModuleResource mitk::CloseRegionTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Close_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Close_Cursor.svg"); return resource; } const char *mitk::CloseRegionTool::GetName() const { return "Close"; } template void DoITKRegionClosing(const itk::Image* oldSegImage, mitk::Image::Pointer& filledRegionImage, itk::Index seedIndex, mitk::Label::PixelType& seedLabel) { typedef itk::Image InputImageType; typedef itk::Image OutputImageType; typedef itk::ConnectedThresholdImageFilter RegionGrowingFilterType; using FillHoleFilter = itk::BinaryFillholeImageFilter; seedLabel = oldSegImage->GetPixel(seedIndex); typename OutputImageType::Pointer itkResultImage; filledRegionImage = nullptr; try { auto regionGrower = RegionGrowingFilterType::New(); regionGrower->SetInput(oldSegImage); regionGrower->SetReplaceValue(1); regionGrower->AddSeed(seedIndex); regionGrower->SetLower(seedLabel); regionGrower->SetUpper(seedLabel); auto filler = FillHoleFilter::New(); filler->SetInput(regionGrower->GetOutput()); filler->SetForegroundValue(1); filler->Update(); itkResultImage = filler->GetOutput(); } catch (const itk::ExceptionObject&) { return; // can't work } catch (...) { return; } mitk::CastToMitkImage(itkResultImage, filledRegionImage); } mitk::Image::Pointer mitk::CloseRegionTool::GenerateFillImage(const Image* workingSlice, Point3D seedPoint, mitk::Label::PixelType& seedLabelValue) const { itk::Index<2> seedIndex; workingSlice->GetGeometry()->WorldToIndex(seedPoint, seedIndex); Image::Pointer fillImage; AccessFixedDimensionByItk_n(workingSlice, DoITKRegionClosing, 2, (fillImage, seedIndex, seedLabelValue)); auto labelSetImage = dynamic_cast(this->GetWorkingData()); if (seedLabelValue == labelSetImage->GetExteriorLabel()->GetValue()) { return nullptr; } return fillImage; } void mitk::CloseRegionTool::PrepareFilling(const Image* /*workingSlice*/, Point3D /*seedPoint*/) { m_FillLabelValue = m_SeedLabelValue; m_MergeStyle = MultiLabelSegmentation::MergeStyle::Merge; }; diff --git a/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.cpp b/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.cpp index 644e2de507..0ccdcdfae6 100644 --- a/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.cpp +++ b/Modules/Segmentation/Interactions/mitkDrawPaintbrushTool.cpp @@ -1,59 +1,59 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkDrawPaintbrushTool.h" #include "mitkDrawPaintbrushTool.xpm" // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, DrawPaintbrushTool, "Paintbrush drawing tool"); } mitk::DrawPaintbrushTool::DrawPaintbrushTool() : PaintbrushTool(1) { FeedbackContourTool::SetFeedbackContourColorDefault(); } mitk::DrawPaintbrushTool::~DrawPaintbrushTool() { } const char **mitk::DrawPaintbrushTool::GetXPM() const { return mitkDrawPaintbrushTool_xpm; } us::ModuleResource mitk::DrawPaintbrushTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Paint_48x48.png"); + us::ModuleResource resource = module->GetResource("Paint.svg"); return resource; } us::ModuleResource mitk::DrawPaintbrushTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Paint_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Paint_Cursor.svg"); return resource; } const char *mitk::DrawPaintbrushTool::GetName() const { return "Paint"; } diff --git a/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.cpp b/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.cpp index 88a3589bcc..f57cc037be 100644 --- a/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.cpp +++ b/Modules/Segmentation/Interactions/mitkErasePaintbrushTool.cpp @@ -1,59 +1,59 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkErasePaintbrushTool.h" #include "mitkErasePaintbrushTool.xpm" // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, ErasePaintbrushTool, "Paintbrush erasing tool"); } mitk::ErasePaintbrushTool::ErasePaintbrushTool() : PaintbrushTool(0) { FeedbackContourTool::SetFeedbackContourColor(1.0, 0.0, 0.0); } mitk::ErasePaintbrushTool::~ErasePaintbrushTool() { } const char **mitk::ErasePaintbrushTool::GetXPM() const { return mitkErasePaintbrushTool_xpm; } us::ModuleResource mitk::ErasePaintbrushTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Wipe_48x48.png"); + us::ModuleResource resource = module->GetResource("Wipe.svg"); return resource; } us::ModuleResource mitk::ErasePaintbrushTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Wipe_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Wipe_Cursor.svg"); return resource; } const char *mitk::ErasePaintbrushTool::GetName() const { return "Wipe"; } diff --git a/Modules/Segmentation/Interactions/mitkEraseRegionTool.cpp b/Modules/Segmentation/Interactions/mitkEraseRegionTool.cpp index 928c0507f4..c3003cf49d 100644 --- a/Modules/Segmentation/Interactions/mitkEraseRegionTool.cpp +++ b/Modules/Segmentation/Interactions/mitkEraseRegionTool.cpp @@ -1,93 +1,93 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkEraseRegionTool.h" #include "mitkEraseRegionTool.xpm" #include #include #include // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, EraseRegionTool, "Erase tool"); } const char **mitk::EraseRegionTool::GetXPM() const { return mitkEraseRegionTool_xpm; } us::ModuleResource mitk::EraseRegionTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Erase_48x48.png"); + us::ModuleResource resource = module->GetResource("Erase.svg"); return resource; } us::ModuleResource mitk::EraseRegionTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Erase_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Erase_Cursor.svg"); return resource; } const char *mitk::EraseRegionTool::GetName() const { return "Erase"; } template void DoFillImage(itk::Image* image) { image->FillBuffer(1); }; mitk::Image::Pointer mitk::EraseRegionTool::GenerateFillImage(const Image* workingSlice, Point3D seedPoint, mitk::Label::PixelType& seedLabelValue) const { auto labelSetImage = dynamic_cast(this->GetWorkingData()); itk::Index<2> seedIndex; workingSlice->GetGeometry()->WorldToIndex(seedPoint, seedIndex); using AccessorType = ImagePixelReadAccessor; AccessorType accessor(workingSlice); seedLabelValue = accessor.GetPixelByIndex(seedIndex); Image::Pointer fillImage; if ( seedLabelValue == labelSetImage->GetExteriorLabel()->GetValue()) { //clicked on background remove everything which is not locked. fillImage = workingSlice->Clone(); AccessByItk(fillImage, DoFillImage); } else { fillImage = Superclass::GenerateFillImage(workingSlice, seedPoint, seedLabelValue); } return fillImage; } void mitk::EraseRegionTool::PrepareFilling(const Image* /*workingSlice*/, Point3D /*seedPoint*/) { auto labelSetImage = dynamic_cast(this->GetWorkingData()); if (nullptr != labelSetImage) { m_FillLabelValue = labelSetImage->GetExteriorLabel()->GetValue(); } }; diff --git a/Modules/Segmentation/Interactions/mitkFillRegionTool.cpp b/Modules/Segmentation/Interactions/mitkFillRegionTool.cpp index cdde1d0b95..bde58bce1a 100644 --- a/Modules/Segmentation/Interactions/mitkFillRegionTool.cpp +++ b/Modules/Segmentation/Interactions/mitkFillRegionTool.cpp @@ -1,59 +1,59 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkFillRegionTool.h" // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, FillRegionTool, "Fill tool"); } const char **mitk::FillRegionTool::GetXPM() const { return nullptr; } us::ModuleResource mitk::FillRegionTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Fill_48x48.png"); + us::ModuleResource resource = module->GetResource("Fill.svg"); return resource; } us::ModuleResource mitk::FillRegionTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Fill_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Fill_Cursor.svg"); return resource; } const char *mitk::FillRegionTool::GetName() const { return "Fill"; } void mitk::FillRegionTool::PrepareFilling(const Image* /*workingSlice*/, Point3D /*seedPoint*/) { auto labelSetImage = dynamic_cast(this->GetWorkingData()); if (nullptr == labelSetImage) mitkThrow() << "Invalid state of FillRegionTool. Working image is not of correct type."; m_FillLabelValue = labelSetImage->GetActiveLabel()->GetValue(); m_MergeStyle = MultiLabelSegmentation::MergeStyle::Merge; }; diff --git a/Modules/Segmentation/Interactions/mitkLassoTool.cpp b/Modules/Segmentation/Interactions/mitkLassoTool.cpp index 84adb3ee05..0db153a207 100644 --- a/Modules/Segmentation/Interactions/mitkLassoTool.cpp +++ b/Modules/Segmentation/Interactions/mitkLassoTool.cpp @@ -1,70 +1,70 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ //#include #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, LassoTool, "Lasso tool"); } mitk::LassoTool::LassoTool() : EditableContourTool() { } mitk::LassoTool::~LassoTool() {} void mitk::LassoTool::ConnectActionsAndFunctions() { mitk::EditableContourTool::ConnectActionsAndFunctions(); CONNECT_FUNCTION("MovePoint", OnMouseMoved); } const char **mitk::LassoTool::GetXPM() const { return nullptr; } us::ModuleResource mitk::LassoTool::GetIconResource() const { - return us::GetModuleContext()->GetModule()->GetResource("NewAdd_48x48.png"); + return us::GetModuleContext()->GetModule()->GetResource("Lasso.svg"); } us::ModuleResource mitk::LassoTool::GetCursorIconResource() const { - return us::GetModuleContext()->GetModule()->GetResource("NewAdd_Cursor_32x32.png"); + return us::GetModuleContext()->GetModule()->GetResource("Lasso_Cursor.svg"); } const char *mitk::LassoTool::GetName() const { return "Lasso"; } void mitk::LassoTool::FinishTool() { auto contourInteractor = mitk::ContourModelInteractor::New(); contourInteractor->SetDataNode(m_ContourNode); contourInteractor->LoadStateMachine("ContourModelModificationInteractor.xml", us::GetModuleContext()->GetModule()); contourInteractor->SetEventConfig("ContourModelModificationConfig.xml", us::GetModuleContext()->GetModule()); contourInteractor->SetRestrictedArea(this->m_CurrentRestrictedArea); this->m_ContourInteractor = contourInteractor; m_ContourNode->SetDataInteractor(m_ContourInteractor.GetPointer()); } diff --git a/Modules/Segmentation/Interactions/mitkLiveWireTool2D.cpp b/Modules/Segmentation/Interactions/mitkLiveWireTool2D.cpp index 861f2bd557..b7a4cd5ad5 100644 --- a/Modules/Segmentation/Interactions/mitkLiveWireTool2D.cpp +++ b/Modules/Segmentation/Interactions/mitkLiveWireTool2D.cpp @@ -1,261 +1,261 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include #include #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, LiveWireTool2D, "LiveWire tool"); } mitk::LiveWireTool2D::LiveWireTool2D() : EditableContourTool(), m_CreateAndUseDynamicCosts(false) { } mitk::LiveWireTool2D::~LiveWireTool2D() { } void mitk::LiveWireTool2D::ConnectActionsAndFunctions() { mitk::EditableContourTool::ConnectActionsAndFunctions(); CONNECT_FUNCTION("MovePoint", OnMouseMoveNoDynamicCosts); } const char **mitk::LiveWireTool2D::GetXPM() const { return mitkLiveWireTool2D_xpm; } us::ModuleResource mitk::LiveWireTool2D::GetIconResource() const { - return us::GetModuleContext()->GetModule()->GetResource("LiveWire_48x48.png"); + return us::GetModuleContext()->GetModule()->GetResource("LiveWire.svg"); } us::ModuleResource mitk::LiveWireTool2D::GetCursorIconResource() const { - return us::GetModuleContext()->GetModule()->GetResource("LiveWire_Cursor_32x32.png"); + return us::GetModuleContext()->GetModule()->GetResource("LiveWire_Cursor.svg"); } const char *mitk::LiveWireTool2D::GetName() const { return "Live Wire"; } void mitk::LiveWireTool2D::UpdateLiveWireContour() { auto contour = this->GetContour(); if (nullptr != contour) { auto timeGeometry = contour->GetTimeGeometry()->Clone(); m_PreviewContour = this->m_LiveWireFilter->GetOutput(); // needed because the results of the filter are always from 0 ms // to 1 ms and the filter also resets its outputs. // generate a time geometry that is always visible as the working contour should always be. auto contourTimeGeometry = ProportionalTimeGeometry::New(); contourTimeGeometry->SetStepDuration(std::numeric_limits::max()); contourTimeGeometry->SetTimeStepGeometry(contour->GetTimeGeometry()->GetGeometryForTimeStep(0)->Clone(), 0); m_PreviewContour->SetTimeGeometry(contourTimeGeometry); m_PreviewContourNode->SetData(this->m_PreviewContour); } } void mitk::LiveWireTool2D::OnTimePointChanged() { auto reference = this->GetReferenceData(); if (nullptr == reference || m_PlaneGeometry.IsNull() || m_LiveWireFilter.IsNull() || m_PreviewContourNode.IsNull()) return; auto timeStep = reference->GetTimeGeometry()->TimePointToTimeStep(this->GetLastTimePointTriggered()); m_ReferenceDataSlice = GetAffectedImageSliceAs2DImageByTimePoint(m_PlaneGeometry, reference, timeStep); m_LiveWireFilter->SetInput(m_ReferenceDataSlice); m_LiveWireFilter->Update(); this->UpdateLiveWireContour(); RenderingManager::GetInstance()->RequestUpdateAll(); }; mitk::Point3D mitk::LiveWireTool2D::PrepareInitContour(const mitk::Point3D& clickedPoint) { // Set current slice as input for ImageToLiveWireContourFilter m_LiveWireFilter = ImageLiveWireContourModelFilter::New(); m_LiveWireFilter->SetUseCostFunction(true); m_LiveWireFilter->SetInput(m_ReferenceDataSlice); itk::Index<3> idx; m_ReferenceDataSlice->GetGeometry()->WorldToIndex(clickedPoint, idx); // Get the pixel with the highest gradient in a 7x7 region itk::Index<3> indexWithHighestGradient; AccessFixedDimensionByItk_2(m_ReferenceDataSlice, FindHighestGradientMagnitudeByITK, 2, idx, indexWithHighestGradient); Point3D adaptedClick; m_ReferenceDataSlice->GetGeometry()->IndexToWorld(indexWithHighestGradient, adaptedClick); m_CreateAndUseDynamicCosts = true; return adaptedClick; } void mitk::LiveWireTool2D::FinalizePreviewContour(const Point3D& clickedPoint) { // Add repulsive points to avoid getting the same path again std::for_each(m_PreviewContour->IteratorBegin(), m_PreviewContour->IteratorEnd(), [this](ContourElement::VertexType* vertex) { ImageLiveWireContourModelFilter::InternalImageType::IndexType idx; this->m_ReferenceDataSlice->GetGeometry()->WorldToIndex(vertex->Coordinates, idx); this->m_LiveWireFilter->AddRepulsivePoint(idx); }); EditableContourTool::FinalizePreviewContour(clickedPoint); } void mitk::LiveWireTool2D::InitializePreviewContour(const Point3D& clickedPoint) { m_PreviewContour->Clear(); // Set new start point m_LiveWireFilter->SetStartPoint(clickedPoint); if (m_CreateAndUseDynamicCosts) { auto contour = this->GetContour(); // Use dynamic cost map for next update m_LiveWireFilter->CreateDynamicCostMap(contour); m_LiveWireFilter->SetUseDynamicCostMap(true); } } void mitk::LiveWireTool2D::UpdatePreviewContour(const Point3D& clickedPoint) { // Compute LiveWire segment from last control point to current mouse position m_LiveWireFilter->SetEndPoint(clickedPoint); m_LiveWireFilter->Update(); this->UpdateLiveWireContour(); } void mitk::LiveWireTool2D::OnMouseMoveNoDynamicCosts(StateMachineAction *, InteractionEvent *interactionEvent) { m_LiveWireFilter->SetUseDynamicCostMap(false); this->OnMouseMoved(nullptr, interactionEvent); m_LiveWireFilter->SetUseDynamicCostMap(true); } void mitk::LiveWireTool2D::FinishTool() { m_LiveWireFilter->SetUseDynamicCostMap(false); m_ContourInteractor = mitk::ContourModelLiveWireInteractor::New(); m_ContourInteractor->SetDataNode(m_ContourNode); m_ContourInteractor->LoadStateMachine("ContourModelModificationInteractor.xml", us::GetModuleContext()->GetModule()); m_ContourInteractor->SetEventConfig("ContourModelModificationConfig.xml", us::GetModuleContext()->GetModule()); m_ContourInteractor->SetWorkingImage(this->m_ReferenceDataSlice); m_ContourInteractor->SetRestrictedArea(this->m_CurrentRestrictedArea); m_ContourNode->SetDataInteractor(m_ContourInteractor.GetPointer()); } template void mitk::LiveWireTool2D::FindHighestGradientMagnitudeByITK(itk::Image *inputImage, itk::Index<3> &index, itk::Index<3> &returnIndex) { typedef itk::Image InputImageType; typedef typename InputImageType::IndexType IndexType; const auto MAX_X = inputImage->GetLargestPossibleRegion().GetSize()[0]; const auto MAX_Y = inputImage->GetLargestPossibleRegion().GetSize()[1]; returnIndex[0] = index[0]; returnIndex[1] = index[1]; returnIndex[2] = 0.0; double gradientMagnitude = 0.0; double maxGradientMagnitude = 0.0; // The size and thus the region of 7x7 is only used to calculate the gradient magnitude in that region, // not for searching the maximum value. // Maximum value in each direction for size typename InputImageType::SizeType size; size[0] = 7; size[1] = 7; // Minimum value in each direction for startRegion IndexType startRegion; startRegion[0] = index[0] - 3; startRegion[1] = index[1] - 3; if (startRegion[0] < 0) startRegion[0] = 0; if (startRegion[1] < 0) startRegion[1] = 0; if (MAX_X - index[0] < 7) startRegion[0] = MAX_X - 7; if (MAX_Y - index[1] < 7) startRegion[1] = MAX_Y - 7; index[0] = startRegion[0] + 3; index[1] = startRegion[1] + 3; typename InputImageType::RegionType region; region.SetSize(size); region.SetIndex(startRegion); typedef typename itk::GradientMagnitudeImageFilter GradientMagnitudeFilterType; typename GradientMagnitudeFilterType::Pointer gradientFilter = GradientMagnitudeFilterType::New(); gradientFilter->SetInput(inputImage); gradientFilter->GetOutput()->SetRequestedRegion(region); gradientFilter->Update(); typename InputImageType::Pointer gradientMagnitudeImage; gradientMagnitudeImage = gradientFilter->GetOutput(); IndexType currentIndex; currentIndex[0] = 0; currentIndex[1] = 0; // Search max (approximate) gradient magnitude for (int x = -1; x <= 1; ++x) { currentIndex[0] = index[0] + x; for (int y = -1; y <= 1; ++y) { currentIndex[1] = index[1] + y; gradientMagnitude = gradientMagnitudeImage->GetPixel(currentIndex); // Check for new max if (maxGradientMagnitude < gradientMagnitude) { maxGradientMagnitude = gradientMagnitude; returnIndex[0] = currentIndex[0]; returnIndex[1] = currentIndex[1]; returnIndex[2] = 0.0; } } currentIndex[1] = index[1]; } } diff --git a/Modules/Segmentation/Interactions/mitkOtsuTool3D.cpp b/Modules/Segmentation/Interactions/mitkOtsuTool3D.cpp index a7ce47fcec..ec9cc831fc 100644 --- a/Modules/Segmentation/Interactions/mitkOtsuTool3D.cpp +++ b/Modules/Segmentation/Interactions/mitkOtsuTool3D.cpp @@ -1,87 +1,87 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ // MITK #include "mitkOtsuTool3D.h" #include "mitkOtsuSegmentationFilter.h" // us #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, OtsuTool3D, "Otsu Segmentation"); } void mitk::OtsuTool3D::Activated() { Superclass::Activated(); m_NumberOfBins = 128; m_NumberOfRegions = 2; m_UseValley = false; this->SetLabelTransferMode(LabelTransferMode::AllLabels); } const char **mitk::OtsuTool3D::GetXPM() const { return nullptr; } us::ModuleResource mitk::OtsuTool3D::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Otsu_48x48.png"); + us::ModuleResource resource = module->GetResource("Otsu.svg"); return resource; } const char* mitk::OtsuTool3D::GetName() const { return "Otsu"; } void mitk::OtsuTool3D::DoUpdatePreview(const Image* inputAtTimeStep, const Image* /*oldSegAtTimeStep*/, LabelSetImage* previewImage, TimeStepType timeStep) { int numberOfThresholds = m_NumberOfRegions - 1; mitk::OtsuSegmentationFilter::Pointer otsuFilter = mitk::OtsuSegmentationFilter::New(); otsuFilter->SetNumberOfThresholds(numberOfThresholds); otsuFilter->SetValleyEmphasis(m_UseValley); otsuFilter->SetNumberOfBins(m_NumberOfBins); otsuFilter->SetInput(inputAtTimeStep); otsuFilter->AddObserver(itk::ProgressEvent(), m_ProgressCommand); try { otsuFilter->Update(); } catch (...) { mitkThrow() << "itkOtsuFilter error (image dimension must be in {2, 3} and image must not be RGB)"; } auto otsuResultImage = mitk::LabelSetImage::New(); otsuResultImage->InitializeByLabeledImage(otsuFilter->GetOutput()); TransferLabelSetImageContent(otsuResultImage, previewImage, timeStep); } unsigned int mitk::OtsuTool3D::GetMaxNumberOfBins() const { const auto min = this->GetReferenceData()->GetStatistics()->GetScalarValueMin(); const auto max = this->GetReferenceData()->GetStatistics()->GetScalarValueMaxNoRecompute(); return static_cast(max - min) + 1; } diff --git a/Modules/Segmentation/Interactions/mitkPickingTool.cpp b/Modules/Segmentation/Interactions/mitkPickingTool.cpp index d757a07db4..caccce9710 100644 --- a/Modules/Segmentation/Interactions/mitkPickingTool.cpp +++ b/Modules/Segmentation/Interactions/mitkPickingTool.cpp @@ -1,275 +1,275 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkPickingTool.h" #include "mitkProperties.h" #include "mitkToolManager.h" #include "mitkInteractionPositionEvent.h" // us #include #include #include #include #include "mitkITKImageImport.h" #include "mitkImageAccessByItk.h" #include "mitkImageCast.h" #include "mitkImageTimeSelector.h" #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, PickingTool, "PickingTool"); } mitk::PickingTool::PickingTool() : SegWithPreviewTool(false, "PressMoveReleaseAndPointSetting") { this->ResetsToEmptyPreviewOn(); } mitk::PickingTool::~PickingTool() { } bool mitk::PickingTool::CanHandle(const BaseData* referenceData, const BaseData* workingData) const { if (!Superclass::CanHandle(referenceData,workingData)) return false; auto* image = dynamic_cast(referenceData); if (image == nullptr) return false; return true; } const char **mitk::PickingTool::GetXPM() const { return nullptr; } const char *mitk::PickingTool::GetName() const { return "Picking"; } us::ModuleResource mitk::PickingTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Pick_48x48.png"); + us::ModuleResource resource = module->GetResource("Picking.svg"); return resource; } void mitk::PickingTool::Activated() { Superclass::Activated(); m_PointSet = mitk::PointSet::New(); //ensure that the seed points are visible for all timepoints. dynamic_cast(m_PointSet->GetTimeGeometry())->SetStepDuration(std::numeric_limits::max()); m_PointSetNode = mitk::DataNode::New(); m_PointSetNode->SetData(m_PointSet); m_PointSetNode->SetName(std::string(this->GetName()) + "_PointSet"); m_PointSetNode->SetBoolProperty("helper object", true); m_PointSetNode->SetColor(0.0, 1.0, 0.0); m_PointSetNode->SetVisibility(true); this->GetDataStorage()->Add(m_PointSetNode, this->GetToolManager()->GetWorkingData(0)); } void mitk::PickingTool::Deactivated() { this->ClearSeeds(); // remove from data storage and disable interaction GetDataStorage()->Remove(m_PointSetNode); m_PointSetNode = nullptr; m_PointSet = nullptr; Superclass::Deactivated(); } void mitk::PickingTool::ConnectActionsAndFunctions() { CONNECT_FUNCTION("ShiftSecondaryButtonPressed", OnAddPoint); CONNECT_FUNCTION("ShiftPrimaryButtonPressed", OnAddPoint); CONNECT_FUNCTION("DeletePoint", OnDelete); } void mitk::PickingTool::OnAddPoint(StateMachineAction*, InteractionEvent* interactionEvent) { if (!this->IsUpdating() && m_PointSet.IsNotNull()) { const auto positionEvent = dynamic_cast(interactionEvent); if (positionEvent != nullptr) { m_PointSet->InsertPoint(m_PointSet->GetSize(), positionEvent->GetPositionInWorld()); this->UpdatePreview(); } } } void mitk::PickingTool::OnDelete(StateMachineAction*, InteractionEvent* /*interactionEvent*/) { if (!this->IsUpdating() && m_PointSet.IsNotNull()) { // delete last seed point if (this->m_PointSet->GetSize() > 0) { m_PointSet->RemovePointAtEnd(0); this->UpdatePreview(); } } } void mitk::PickingTool::ClearPicks() { this->ClearSeeds(); this->UpdatePreview(); } bool mitk::PickingTool::HasPicks() const { return this->m_PointSet.IsNotNull() && this->m_PointSet->GetSize()>0; } void mitk::PickingTool::ClearSeeds() { if (this->m_PointSet.IsNotNull()) { // renew pointset this->m_PointSet = mitk::PointSet::New(); //ensure that the seed points are visible for all timepoints. dynamic_cast(m_PointSet->GetTimeGeometry())->SetStepDuration(std::numeric_limits::max()); this->m_PointSetNode->SetData(this->m_PointSet); } } template void DoITKRegionGrowing(const itk::Image* oldSegImage, mitk::Image* segmentation, const mitk::PointSet* seedPoints, unsigned int timeStep, const mitk::BaseGeometry* inputGeometry, const mitk::Label::PixelType outputValue, const mitk::Label::PixelType backgroundValue, bool& emptyTimeStep) { typedef itk::Image InputImageType; typedef itk::Image OutputImageType; typedef typename InputImageType::IndexType IndexType; typedef itk::ConnectedThresholdImageFilter RegionGrowingFilterType; using IndexMapType = std::map < mitk::Label::PixelType, std::vector >; IndexMapType indexMap; // convert world coordinates to image indices for (auto pos = seedPoints->Begin(); pos != seedPoints->End(); ++pos) { IndexType seedIndex; inputGeometry->WorldToIndex(pos->Value(), seedIndex); const auto selectedLabel = oldSegImage->GetPixel(seedIndex); if (selectedLabel != backgroundValue) { indexMap[selectedLabel].push_back(seedIndex); } } typename OutputImageType::Pointer itkResultImage; try { bool first = true; typename RegionGrowingFilterType::Pointer regionGrower = RegionGrowingFilterType::New(); regionGrower->SetInput(oldSegImage); regionGrower->SetReplaceValue(outputValue); for (const auto& [label, indeces] : indexMap) { // perform region growing in desired segmented region regionGrower->ClearSeeds(); for (const auto& index : indeces) { regionGrower->AddSeed(index); } regionGrower->SetLower(label); regionGrower->SetUpper(label); regionGrower->Update(); if (first) { itkResultImage = regionGrower->GetOutput(); } else { typename itk::OrImageFilter::Pointer orFilter = itk::OrImageFilter::New(); orFilter->SetInput1(regionGrower->GetOutput()); orFilter->SetInput2(itkResultImage); orFilter->Update(); itkResultImage = orFilter->GetOutput(); } first = false; itkResultImage->DisconnectPipeline(); } } catch (const itk::ExceptionObject&) { return; // can't work } catch (...) { return; } if (itkResultImage.IsNotNull()) { segmentation->SetVolume((void*)(itkResultImage->GetPixelContainer()->GetBufferPointer()),timeStep); } emptyTimeStep = itkResultImage.IsNull(); } void mitk::PickingTool::DoUpdatePreview(const Image* /*inputAtTimeStep*/, const Image* oldSegAtTimeStep, LabelSetImage* previewImage, TimeStepType timeStep) { if (nullptr != oldSegAtTimeStep && nullptr != previewImage && m_PointSet.IsNotNull()) { bool emptyTimeStep = true; if (this->HasPicks()) { Label::PixelType backgroundValue = 0; auto labelSetImage = dynamic_cast(oldSegAtTimeStep); if (nullptr != labelSetImage) { backgroundValue = labelSetImage->GetExteriorLabel()->GetValue(); } AccessFixedDimensionByItk_n(oldSegAtTimeStep, DoITKRegionGrowing, 3, (previewImage, this->m_PointSet, timeStep, oldSegAtTimeStep->GetGeometry(), this->GetUserDefinedActiveLabel(), backgroundValue, emptyTimeStep)); } if (emptyTimeStep) { this->ResetPreviewContentAtTimeStep(timeStep); } } } diff --git a/Modules/Segmentation/Interactions/mitkRegionGrowingTool.cpp b/Modules/Segmentation/Interactions/mitkRegionGrowingTool.cpp index bd0a9d911e..d214716309 100644 --- a/Modules/Segmentation/Interactions/mitkRegionGrowingTool.cpp +++ b/Modules/Segmentation/Interactions/mitkRegionGrowingTool.cpp @@ -1,463 +1,463 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkRegionGrowingTool.h" #include "mitkBaseRenderer.h" #include "mitkImageToContourModelFilter.h" #include "mitkRegionGrowingTool.xpm" #include "mitkRenderingManager.h" #include "mitkToolManager.h" // us #include #include #include #include // ITK #include "mitkITKImageImport.h" #include "mitkImageAccessByItk.h" #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, RegionGrowingTool, "Region growing tool"); } #define ROUND(a) ((a) > 0 ? (int)((a) + 0.5) : -(int)(0.5 - (a))) mitk::RegionGrowingTool::RegionGrowingTool() : FeedbackContourTool("PressMoveRelease"), m_SeedValue(0), m_ScreenYDifference(0), m_ScreenXDifference(0), m_MouseDistanceScaleFactor(0.5), m_PaintingPixelValue(1), m_FillFeedbackContour(true), m_ConnectedComponentValue(1) { } mitk::RegionGrowingTool::~RegionGrowingTool() { } void mitk::RegionGrowingTool::ConnectActionsAndFunctions() { CONNECT_FUNCTION("PrimaryButtonPressed", OnMousePressed); CONNECT_FUNCTION("Move", OnMouseMoved); CONNECT_FUNCTION("Release", OnMouseReleased); } const char **mitk::RegionGrowingTool::GetXPM() const { return mitkRegionGrowingTool_xpm; } us::ModuleResource mitk::RegionGrowingTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("RegionGrowing_48x48.png"); + us::ModuleResource resource = module->GetResource("RegionGrowing.svg"); return resource; } us::ModuleResource mitk::RegionGrowingTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("RegionGrowing_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("RegionGrowing_Cursor.svg"); return resource; } const char *mitk::RegionGrowingTool::GetName() const { return "Region Growing"; } void mitk::RegionGrowingTool::Activated() { Superclass::Activated(); } void mitk::RegionGrowingTool::Deactivated() { Superclass::Deactivated(); } // Get the average pixel value of square/cube with radius=neighborhood around index template void mitk::RegionGrowingTool::GetNeighborhoodAverage(const itk::Image *itkImage, const itk::Index& index, ScalarType *result, unsigned int neighborhood) { // maybe assert that image dimension is only 2 or 3? auto neighborhoodInt = (int)neighborhood; TPixel averageValue(0); unsigned int numberOfPixels = (2 * neighborhood + 1) * (2 * neighborhood + 1); if (imageDimension == 3) { numberOfPixels *= (2 * neighborhood + 1); } MITK_DEBUG << "Getting neighborhood of " << numberOfPixels << " pixels around " << index; itk::Index currentIndex; for (int i = (0 - neighborhoodInt); i <= neighborhoodInt; ++i) { currentIndex[0] = index[0] + i; for (int j = (0 - neighborhoodInt); j <= neighborhoodInt; ++j) { currentIndex[1] = index[1] + j; if (imageDimension == 3) { for (int k = (0 - neighborhoodInt); k <= neighborhoodInt; ++k) { currentIndex[2] = index[2] + k; if (itkImage->GetLargestPossibleRegion().IsInside(currentIndex)) { averageValue += itkImage->GetPixel(currentIndex); } else { numberOfPixels -= 1; } } } else { if (itkImage->GetLargestPossibleRegion().IsInside(currentIndex)) { averageValue += itkImage->GetPixel(currentIndex); } else { numberOfPixels -= 1; } } } } *result = (ScalarType)averageValue; *result /= numberOfPixels; } // Do the region growing (i.e. call an ITK filter that does it) template void mitk::RegionGrowingTool::StartRegionGrowing(const itk::Image *inputImage, const itk::Index& seedIndex, const std::array& thresholds, mitk::Image::Pointer &outputImage) { MITK_DEBUG << "Starting region growing at index " << seedIndex << " with lower threshold " << thresholds[0] << " and upper threshold " << thresholds[1]; typedef itk::Image InputImageType; typedef itk::Image OutputImageType; typedef itk::ConnectedThresholdImageFilter RegionGrowingFilterType; typename RegionGrowingFilterType::Pointer regionGrower = RegionGrowingFilterType::New(); // perform region growing in desired segmented region regionGrower->SetInput(inputImage); regionGrower->SetSeed(seedIndex); regionGrower->SetLower(thresholds[0]); regionGrower->SetUpper(thresholds[1]); try { regionGrower->Update(); } catch (...) { return; // Should we do something? } typename OutputImageType::Pointer resultImage = regionGrower->GetOutput(); // Smooth result: Every pixel is replaced by the majority of the neighborhood typedef itk::NeighborhoodIterator NeighborhoodIteratorType; typedef itk::ImageRegionIterator ImageIteratorType; typename NeighborhoodIteratorType::RadiusType radius; radius.Fill(2); // for now, maybe make this something the user can adjust in the preferences? typedef itk::ImageDuplicator< OutputImageType > DuplicatorType; typename DuplicatorType::Pointer duplicator = DuplicatorType::New(); duplicator->SetInputImage(resultImage); duplicator->Update(); typename OutputImageType::Pointer resultDup = duplicator->GetOutput(); NeighborhoodIteratorType neighborhoodIterator(radius, resultDup, resultDup->GetRequestedRegion()); ImageIteratorType imageIterator(resultImage, resultImage->GetRequestedRegion()); for (neighborhoodIterator.GoToBegin(), imageIterator.GoToBegin(); !neighborhoodIterator.IsAtEnd(); ++neighborhoodIterator, ++imageIterator) { DefaultSegmentationDataType voteYes(0); DefaultSegmentationDataType voteNo(0); for (unsigned int i = 0; i < neighborhoodIterator.Size(); ++i) { if (neighborhoodIterator.GetPixel(i) > 0) { voteYes += 1; } else { voteNo += 1; } } if (voteYes > voteNo) { imageIterator.Set(1); } else { imageIterator.Set(0); } } if (resultImage.IsNull()) { MITK_DEBUG << "Region growing result is empty."; } // Can potentially have multiple regions, use connected component image filter to label disjunct regions typedef itk::ConnectedComponentImageFilter ConnectedComponentImageFilterType; typename ConnectedComponentImageFilterType::Pointer connectedComponentFilter = ConnectedComponentImageFilterType::New(); connectedComponentFilter->SetInput(resultImage); connectedComponentFilter->Update(); typename OutputImageType::Pointer resultImageCC = connectedComponentFilter->GetOutput(); m_ConnectedComponentValue = resultImageCC->GetPixel(seedIndex); outputImage = mitk::GrabItkImageMemory(resultImageCC); } template void mitk::RegionGrowingTool::CalculateInitialThresholds(const itk::Image*) { LevelWindow levelWindow; this->GetToolManager()->GetReferenceData(0)->GetLevelWindow(levelWindow); m_ThresholdExtrema[0] = static_cast(std::numeric_limits::lowest()); m_ThresholdExtrema[1] = static_cast(std::numeric_limits::max()); const ScalarType lowerWindowBound = std::max(m_ThresholdExtrema[0], levelWindow.GetLowerWindowBound()); const ScalarType upperWindowBound = std::min(m_ThresholdExtrema[1], levelWindow.GetUpperWindowBound()); if (m_SeedValue < lowerWindowBound) { m_InitialThresholds = { m_ThresholdExtrema[0], lowerWindowBound }; } else if (m_SeedValue > upperWindowBound) { m_InitialThresholds = { upperWindowBound, m_ThresholdExtrema[1] }; } else { const ScalarType range = 0.1 * (upperWindowBound - lowerWindowBound); // 10% of the visible window m_InitialThresholds[0] = std::min(std::max(lowerWindowBound, m_SeedValue - 0.5 * range), upperWindowBound - range); m_InitialThresholds[1] = m_InitialThresholds[0] + range; } } void mitk::RegionGrowingTool::OnMousePressed(StateMachineAction*, InteractionEvent* interactionEvent) { auto* positionEvent = dynamic_cast(interactionEvent); if (nullptr == positionEvent) { return; } m_LastEventSender = positionEvent->GetSender(); m_LastEventSlice = m_LastEventSender->GetSlice(); m_LastScreenPosition = Point2I(positionEvent->GetPointerPositionOnScreen()); // ReferenceSlice is from the underlying image, WorkingSlice from the active segmentation (can be empty) m_ReferenceSlice = FeedbackContourTool::GetAffectedReferenceSlice(positionEvent); m_WorkingSlice = FeedbackContourTool::GetAffectedWorkingSlice(positionEvent); if (m_WorkingSlice.IsNull()) { // can't do anything without a working slice (i.e. a possibly empty segmentation) return; } // Determine if the user clicked inside or outside of the working slice (i.e. the whole volume) mitk::BaseGeometry::Pointer workingSliceGeometry; workingSliceGeometry = m_WorkingSlice->GetGeometry(); workingSliceGeometry->WorldToIndex(positionEvent->GetPositionInWorld(), m_SeedPoint); itk::Index<2> indexInWorkingSlice2D; indexInWorkingSlice2D[0] = m_SeedPoint[0]; indexInWorkingSlice2D[1] = m_SeedPoint[1]; if (!workingSliceGeometry->IsIndexInside(m_SeedPoint)) { MITK_DEBUG << "OnMousePressed: point " << positionEvent->GetPositionInWorld() << " (index coordinates " << m_SeedPoint << ") is not inside working slice"; return; } mitk::BaseGeometry::Pointer referenceSliceGeometry; referenceSliceGeometry = m_ReferenceSlice->GetGeometry(); itk::Index<3> indexInReferenceSlice; itk::Index<2> indexInReferenceSlice2D; referenceSliceGeometry->WorldToIndex(positionEvent->GetPositionInWorld(), indexInReferenceSlice); indexInReferenceSlice2D[0] = indexInReferenceSlice[0]; indexInReferenceSlice2D[1] = indexInReferenceSlice[1]; // Get seed neighborhood ScalarType averageValue(0); AccessFixedDimensionByItk_3(m_ReferenceSlice, GetNeighborhoodAverage, 2, indexInReferenceSlice2D, &averageValue, 1); m_SeedValue = averageValue; MITK_DEBUG << "Seed value is " << m_SeedValue; // Calculate initial thresholds AccessFixedDimensionByItk(m_ReferenceSlice, CalculateInitialThresholds, 2); m_Thresholds[0] = m_InitialThresholds[0]; m_Thresholds[1] = m_InitialThresholds[1]; // Perform region growing mitk::Image::Pointer resultImage = mitk::Image::New(); AccessFixedDimensionByItk_3( m_ReferenceSlice, StartRegionGrowing, 2, indexInWorkingSlice2D, m_Thresholds, resultImage); resultImage->SetGeometry(workingSliceGeometry); // Extract contour if (resultImage.IsNotNull() && m_ConnectedComponentValue >= 1) { float isoOffset = 0.33; mitk::ImageToContourModelFilter::Pointer contourExtractor = mitk::ImageToContourModelFilter::New(); contourExtractor->SetInput(resultImage); contourExtractor->SetContourValue(m_ConnectedComponentValue - isoOffset); contourExtractor->Update(); ContourModel::Pointer resultContour = ContourModel::New(); resultContour = contourExtractor->GetOutput(); // Show contour if (resultContour.IsNotNull()) { ContourModel::Pointer resultContourWorld = FeedbackContourTool::BackProjectContourFrom2DSlice( workingSliceGeometry, FeedbackContourTool::ProjectContourTo2DSlice(m_WorkingSlice, resultContour)); FeedbackContourTool::UpdateCurrentFeedbackContour(resultContourWorld); FeedbackContourTool::SetFeedbackContourVisible(true); mitk::RenderingManager::GetInstance()->RequestUpdate(m_LastEventSender->GetRenderWindow()); } } } void mitk::RegionGrowingTool::OnMouseMoved(StateMachineAction*, InteractionEvent* interactionEvent) { auto* positionEvent = dynamic_cast(interactionEvent); if (nullptr == positionEvent) { return; } if (m_ReferenceSlice.IsNull()) { return; } // Get geometry and indices mitk::BaseGeometry::Pointer workingSliceGeometry; workingSliceGeometry = m_WorkingSlice->GetGeometry(); itk::Index<2> indexInWorkingSlice2D; indexInWorkingSlice2D[0] = m_SeedPoint[0]; indexInWorkingSlice2D[1] = m_SeedPoint[1]; m_ScreenYDifference += positionEvent->GetPointerPositionOnScreen()[1] - m_LastScreenPosition[1]; m_ScreenXDifference += positionEvent->GetPointerPositionOnScreen()[0] - m_LastScreenPosition[0]; m_LastScreenPosition = Point2I(positionEvent->GetPointerPositionOnScreen()); // Moving the mouse up and down adjusts the width of the threshold window, // moving it left and right shifts the threshold window m_Thresholds[0] = std::min( m_SeedValue, m_InitialThresholds[0] - (m_ScreenYDifference - m_ScreenXDifference) * m_MouseDistanceScaleFactor); m_Thresholds[1] = std::max( m_SeedValue, m_InitialThresholds[1] + (m_ScreenYDifference + m_ScreenXDifference) * m_MouseDistanceScaleFactor); // Do not exceed the pixel type extrema of the reference slice, though m_Thresholds[0] = std::max(m_ThresholdExtrema[0], m_Thresholds[0]); m_Thresholds[1] = std::min(m_ThresholdExtrema[1], m_Thresholds[1]); // Perform region growing again and show the result mitk::Image::Pointer resultImage = mitk::Image::New(); AccessFixedDimensionByItk_3( m_ReferenceSlice, StartRegionGrowing, 2, indexInWorkingSlice2D, m_Thresholds, resultImage); resultImage->SetGeometry(workingSliceGeometry); // Update the contour if (resultImage.IsNotNull() && m_ConnectedComponentValue >= 1) { float isoOffset = 0.33; mitk::ImageToContourModelFilter::Pointer contourExtractor = mitk::ImageToContourModelFilter::New(); contourExtractor->SetInput(resultImage); contourExtractor->SetContourValue(m_ConnectedComponentValue - isoOffset); contourExtractor->Update(); ContourModel::Pointer resultContour = ContourModel::New(); resultContour = contourExtractor->GetOutput(); // Show contour if (resultContour.IsNotNull()) { ContourModel::Pointer resultContourWorld = FeedbackContourTool::BackProjectContourFrom2DSlice( workingSliceGeometry, FeedbackContourTool::ProjectContourTo2DSlice(m_WorkingSlice, resultContour)); FeedbackContourTool::UpdateCurrentFeedbackContour(resultContourWorld); FeedbackContourTool::SetFeedbackContourVisible(true); mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(positionEvent->GetSender()->GetRenderWindow()); } } } void mitk::RegionGrowingTool::OnMouseReleased(StateMachineAction*, InteractionEvent* interactionEvent) { auto* positionEvent = dynamic_cast(interactionEvent); if (nullptr == positionEvent) { return; } if (m_WorkingSlice.IsNull() && m_FillFeedbackContour) { return; } if (m_FillFeedbackContour) { this->WriteBackFeedbackContourAsSegmentationResult(positionEvent, m_PaintingPixelValue); m_ScreenYDifference = 0; m_ScreenXDifference = 0; } } diff --git a/Modules/Segmentation/Interactions/mitkSubtractContourTool.cpp b/Modules/Segmentation/Interactions/mitkSubtractContourTool.cpp index 17a3fb3cd7..1d3391b08b 100644 --- a/Modules/Segmentation/Interactions/mitkSubtractContourTool.cpp +++ b/Modules/Segmentation/Interactions/mitkSubtractContourTool.cpp @@ -1,59 +1,59 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitkSubtractContourTool.h" #include "mitkSubtractContourTool.xpm" // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, SubtractContourTool, "Subtract tool"); } mitk::SubtractContourTool::SubtractContourTool() : ContourTool(0) { FeedbackContourTool::SetFeedbackContourColor(1.0, 0.0, 0.0); } mitk::SubtractContourTool::~SubtractContourTool() { } const char **mitk::SubtractContourTool::GetXPM() const { return mitkSubtractContourTool_xpm; } us::ModuleResource mitk::SubtractContourTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Subtract_48x48.png"); + us::ModuleResource resource = module->GetResource("Subtract.svg"); return resource; } us::ModuleResource mitk::SubtractContourTool::GetCursorIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("Subtract_Cursor_32x32.png"); + us::ModuleResource resource = module->GetResource("Subtract_Cursor.svg"); return resource; } const char *mitk::SubtractContourTool::GetName() const { return "Subtract"; } diff --git a/Modules/Segmentation/Interactions/mitknnUnetTool.cpp b/Modules/Segmentation/Interactions/mitknnUnetTool.cpp index 1245ee2124..9a64f9d539 100644 --- a/Modules/Segmentation/Interactions/mitknnUnetTool.cpp +++ b/Modules/Segmentation/Interactions/mitknnUnetTool.cpp @@ -1,320 +1,320 @@ /*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ #include "mitknnUnetTool.h" #include "mitkIOUtil.h" #include "mitkProcessExecutor.h" #include #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, nnUNetTool, "nnUNet tool"); } mitk::nnUNetTool::nnUNetTool() { this->SetMitkTempDir(IOUtil::CreateTemporaryDirectory("mitk-XXXXXX")); } mitk::nnUNetTool::~nnUNetTool() { itksys::SystemTools::RemoveADirectory(this->GetMitkTempDir()); } void mitk::nnUNetTool::Activated() { Superclass::Activated(); this->SetLabelTransferMode(LabelTransferMode::AllLabels); } void mitk::nnUNetTool::RenderOutputBuffer() { if (m_OutputBuffer != nullptr) { try { if (nullptr != this->GetPreviewSegmentationNode()) { auto previewImage = this->GetPreviewSegmentation(); previewImage->InitializeByLabeledImage(m_OutputBuffer); } } catch (const mitk::Exception &e) { MITK_INFO << e.GetDescription(); } } } void mitk::nnUNetTool::SetOutputBuffer(LabelSetImage::Pointer segmentation) { m_OutputBuffer = segmentation; } mitk::LabelSetImage::Pointer mitk::nnUNetTool::GetOutputBuffer() { return m_OutputBuffer; } void mitk::nnUNetTool::ClearOutputBuffer() { m_OutputBuffer = nullptr; } us::ModuleResource mitk::nnUNetTool::GetIconResource() const { us::Module *module = us::GetModuleContext()->GetModule(); - us::ModuleResource resource = module->GetResource("AI_48x48.png"); + us::ModuleResource resource = module->GetResource("AI.svg"); return resource; } const char **mitk::nnUNetTool::GetXPM() const { return nullptr; } const char *mitk::nnUNetTool::GetName() const { return "nnUNet"; } mitk::DataStorage *mitk::nnUNetTool::GetDataStorage() { return this->GetToolManager()->GetDataStorage(); } mitk::DataNode *mitk::nnUNetTool::GetRefNode() { return this->GetToolManager()->GetReferenceData(0); } namespace { void onPythonProcessEvent(itk::Object * /*pCaller*/, const itk::EventObject &e, void *) { std::string testCOUT; std::string testCERR; const auto *pEvent = dynamic_cast(&e); if (pEvent) { testCOUT = testCOUT + pEvent->GetOutput(); MITK_INFO << testCOUT; } const auto *pErrEvent = dynamic_cast(&e); if (pErrEvent) { testCERR = testCERR + pErrEvent->GetOutput(); MITK_ERROR << testCERR; } } } // namespace void mitk::nnUNetTool::DoUpdatePreview(const Image* inputAtTimeStep, const Image* /*oldSegAtTimeStep*/, LabelSetImage* previewImage, TimeStepType /*timeStep*/) { std::string inDir, outDir, inputImagePath, outputImagePath, scriptPath; ProcessExecutor::Pointer spExec = ProcessExecutor::New(); itk::CStyleCommand::Pointer spCommand = itk::CStyleCommand::New(); spCommand->SetCallback(&onPythonProcessEvent); spExec->AddObserver(ExternalProcessOutputEvent(), spCommand); ProcessExecutor::ArgumentListType args; inDir = IOUtil::CreateTemporaryDirectory("nnunet-in-XXXXXX", this->GetMitkTempDir()); std::ofstream tmpStream; inputImagePath = IOUtil::CreateTemporaryFile(tmpStream, m_TEMPLATE_FILENAME, inDir + IOUtil::GetDirectorySeparator()); tmpStream.close(); std::size_t found = inputImagePath.find_last_of(IOUtil::GetDirectorySeparator()); std::string fileName = inputImagePath.substr(found + 1); std::string token = fileName.substr(0, fileName.find("_")); if (this->GetNoPip()) { scriptPath = this->GetnnUNetDirectory() + IOUtil::GetDirectorySeparator() + "nnunet" + IOUtil::GetDirectorySeparator() + "inference" + IOUtil::GetDirectorySeparator() + "predict_simple.py"; } try { if (this->GetMultiModal()) { const std::string fileFormat(".nii.gz"); const std::string fileNamePart("_000_000"); std::string outModalFile; size_t len = inDir.length() + 1 + token.length() + fileNamePart.length() + 1 + fileFormat.length(); outModalFile.reserve(len); // The 1(s) indicates a directory separator char and an underscore. for (size_t i = 0; i < m_OtherModalPaths.size(); ++i) { mitk::Image::ConstPointer modalImage = m_OtherModalPaths[i]; outModalFile.append(inDir); outModalFile.push_back(IOUtil::GetDirectorySeparator()); outModalFile.append(token); outModalFile.append(fileNamePart); outModalFile.append(std::to_string(i)); outModalFile.append(fileFormat); IOUtil::Save(modalImage.GetPointer(), outModalFile); outModalFile.clear(); } } else { IOUtil::Save(inputAtTimeStep, inputImagePath); } } catch (const mitk::Exception &e) { /* Can't throw mitk exception to the caller. Refer: T28691 */ MITK_ERROR << e.GetDescription(); return; } // Code calls external process std::string command = "nnUNet_predict"; if (this->GetNoPip()) { #ifdef _WIN32 command = "python"; #else command = "python3"; #endif } for (ModelParams &modelparam : m_ParamQ) { outDir = IOUtil::CreateTemporaryDirectory("nnunet-out-XXXXXX", this->GetMitkTempDir()); outputImagePath = outDir + IOUtil::GetDirectorySeparator() + token + "_000.nii.gz"; modelparam.outputDir = outDir; args.clear(); if (this->GetNoPip()) { args.push_back(scriptPath); } args.push_back("-i"); args.push_back(inDir); args.push_back("-o"); args.push_back(outDir); args.push_back("-t"); args.push_back(modelparam.task); if (modelparam.model.find("cascade") != std::string::npos) { args.push_back("-ctr"); } else { args.push_back("-tr"); } args.push_back(modelparam.trainer); args.push_back("-m"); args.push_back(modelparam.model); args.push_back("-p"); args.push_back(modelparam.planId); if (!modelparam.folds.empty()) { args.push_back("-f"); for (auto fold : modelparam.folds) { args.push_back(fold); } } args.push_back("--num_threads_nifti_save"); args.push_back("1"); // fixing to 1 if (!this->GetMirror()) { args.push_back("--disable_tta"); } if (!this->GetMixedPrecision()) { args.push_back("--disable_mixed_precision"); } if (this->GetEnsemble()) { args.push_back("--save_npz"); } try { std::string resultsFolderEnv = "RESULTS_FOLDER=" + this->GetModelDirectory(); itksys::SystemTools::PutEnv(resultsFolderEnv.c_str()); std::string cudaEnv = "CUDA_VISIBLE_DEVICES=" + std::to_string(this->GetGpuId()); itksys::SystemTools::PutEnv(cudaEnv.c_str()); spExec->Execute(this->GetPythonPath(), command, args); } catch (const mitk::Exception &e) { /* Can't throw mitk exception to the caller. Refer: T28691 */ MITK_ERROR << e.GetDescription(); return; } } if (this->GetEnsemble() && !this->GetPostProcessingJsonDirectory().empty()) { args.clear(); command = "nnUNet_ensemble"; outDir = IOUtil::CreateTemporaryDirectory("nnunet-ensemble-out-XXXXXX", this->GetMitkTempDir()); outputImagePath = outDir + IOUtil::GetDirectorySeparator() + token + "_000.nii.gz"; args.push_back("-f"); for (ModelParams &modelparam : m_ParamQ) { args.push_back(modelparam.outputDir); } args.push_back("-o"); args.push_back(outDir); if (!this->GetPostProcessingJsonDirectory().empty()) { args.push_back("-pp"); args.push_back(this->GetPostProcessingJsonDirectory()); } spExec->Execute(this->GetPythonPath(), command, args); } try { Image::Pointer outputImage = IOUtil::Load(outputImagePath); previewImage->InitializeByLabeledImage(outputImage); previewImage->SetGeometry(inputAtTimeStep->GetGeometry()); m_InputBuffer = inputAtTimeStep; m_OutputBuffer = mitk::LabelSetImage::New(); m_OutputBuffer->InitializeByLabeledImage(outputImage); m_OutputBuffer->SetGeometry(inputAtTimeStep->GetGeometry()); } catch (const mitk::Exception &e) { /* Can't throw mitk exception to the caller. Refer: T28691 */ MITK_ERROR << e.GetDescription(); return; } } diff --git a/Modules/Segmentation/Resources/AI.svg b/Modules/Segmentation/Resources/AI.svg new file mode 100644 index 0000000000..a74640f02c --- /dev/null +++ b/Modules/Segmentation/Resources/AI.svg @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + AI + + + + diff --git a/Modules/Segmentation/Resources/AI_48x48.png b/Modules/Segmentation/Resources/AI_48x48.png deleted file mode 100644 index 9e546998a8..0000000000 Binary files a/Modules/Segmentation/Resources/AI_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/AI_Cursor.svg b/Modules/Segmentation/Resources/AI_Cursor.svg new file mode 100644 index 0000000000..c7b144b6ec --- /dev/null +++ b/Modules/Segmentation/Resources/AI_Cursor.svg @@ -0,0 +1,183 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + AI + + + diff --git a/Modules/Segmentation/Resources/AI_Cursor_32x32.png b/Modules/Segmentation/Resources/AI_Cursor_32x32.png deleted file mode 100644 index fc16240c92..0000000000 Binary files a/Modules/Segmentation/Resources/AI_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Add.svg b/Modules/Segmentation/Resources/Add.svg new file mode 100644 index 0000000000..a2f0c1a24a --- /dev/null +++ b/Modules/Segmentation/Resources/Add.svg @@ -0,0 +1,109 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Add_48x48.png b/Modules/Segmentation/Resources/Add_48x48.png deleted file mode 100644 index 30bda319f1..0000000000 Binary files a/Modules/Segmentation/Resources/Add_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Add_Cursor.svg b/Modules/Segmentation/Resources/Add_Cursor.svg new file mode 100644 index 0000000000..e8bc968006 --- /dev/null +++ b/Modules/Segmentation/Resources/Add_Cursor.svg @@ -0,0 +1,126 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Add_Cursor_32x32.png b/Modules/Segmentation/Resources/Add_Cursor_32x32.png deleted file mode 100644 index f67e1e0437..0000000000 Binary files a/Modules/Segmentation/Resources/Add_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Close.svg b/Modules/Segmentation/Resources/Close.svg new file mode 100644 index 0000000000..24c2cc29fb --- /dev/null +++ b/Modules/Segmentation/Resources/Close.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Close_Cursor.svg b/Modules/Segmentation/Resources/Close_Cursor.svg new file mode 100644 index 0000000000..857d32fb1b --- /dev/null +++ b/Modules/Segmentation/Resources/Close_Cursor.svg @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Erase.svg b/Modules/Segmentation/Resources/Erase.svg new file mode 100644 index 0000000000..37e445a85c --- /dev/null +++ b/Modules/Segmentation/Resources/Erase.svg @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Erase_48x48.png b/Modules/Segmentation/Resources/Erase_48x48.png deleted file mode 100644 index 04bed2302d..0000000000 Binary files a/Modules/Segmentation/Resources/Erase_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Erase_Cursor.svg b/Modules/Segmentation/Resources/Erase_Cursor.svg new file mode 100644 index 0000000000..1fe0b85370 --- /dev/null +++ b/Modules/Segmentation/Resources/Erase_Cursor.svg @@ -0,0 +1,169 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Erase_Cursor_32x32.png b/Modules/Segmentation/Resources/Erase_Cursor_32x32.png deleted file mode 100644 index c218382e39..0000000000 Binary files a/Modules/Segmentation/Resources/Erase_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Fill.svg b/Modules/Segmentation/Resources/Fill.svg new file mode 100644 index 0000000000..d4ad22fd22 --- /dev/null +++ b/Modules/Segmentation/Resources/Fill.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Fill_48x48.png b/Modules/Segmentation/Resources/Fill_48x48.png deleted file mode 100644 index 9f1da9fd4e..0000000000 Binary files a/Modules/Segmentation/Resources/Fill_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Fill_Cursor.svg b/Modules/Segmentation/Resources/Fill_Cursor.svg new file mode 100644 index 0000000000..449620ebdd --- /dev/null +++ b/Modules/Segmentation/Resources/Fill_Cursor.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Fill_Cursor_32x32.png b/Modules/Segmentation/Resources/Fill_Cursor_32x32.png deleted file mode 100644 index 9953754248..0000000000 Binary files a/Modules/Segmentation/Resources/Fill_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Icons.svg b/Modules/Segmentation/Resources/Icons.svg deleted file mode 100644 index 1404173765..0000000000 --- a/Modules/Segmentation/Resources/Icons.svg +++ /dev/null @@ -1,1433 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FM - - - - - - - - - - - - - - AI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 大津 - - - - - - - - - - - - - - - - diff --git a/Modules/Segmentation/Resources/Lasso.svg b/Modules/Segmentation/Resources/Lasso.svg new file mode 100644 index 0000000000..e25c4facd2 --- /dev/null +++ b/Modules/Segmentation/Resources/Lasso.svg @@ -0,0 +1,122 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Lasso_Cursor.svg b/Modules/Segmentation/Resources/Lasso_Cursor.svg new file mode 100644 index 0000000000..de1cef7545 --- /dev/null +++ b/Modules/Segmentation/Resources/Lasso_Cursor.svg @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/LiveWire.svg b/Modules/Segmentation/Resources/LiveWire.svg new file mode 100644 index 0000000000..3874d7e73b --- /dev/null +++ b/Modules/Segmentation/Resources/LiveWire.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/LiveWire_48x48.png b/Modules/Segmentation/Resources/LiveWire_48x48.png deleted file mode 100644 index d2a0e96dbc..0000000000 Binary files a/Modules/Segmentation/Resources/LiveWire_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/LiveWire_Cursor.svg b/Modules/Segmentation/Resources/LiveWire_Cursor.svg new file mode 100644 index 0000000000..7380cb4083 --- /dev/null +++ b/Modules/Segmentation/Resources/LiveWire_Cursor.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/LiveWire_Cursor_32x32.png b/Modules/Segmentation/Resources/LiveWire_Cursor_32x32.png deleted file mode 100644 index 8c0101ba8a..0000000000 Binary files a/Modules/Segmentation/Resources/LiveWire_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/NewAdd_48x48.png b/Modules/Segmentation/Resources/NewAdd_48x48.png deleted file mode 100644 index 3336c07b3c..0000000000 Binary files a/Modules/Segmentation/Resources/NewAdd_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/NewAdd_Cursor_32x32.png b/Modules/Segmentation/Resources/NewAdd_Cursor_32x32.png deleted file mode 100644 index a22b98f416..0000000000 Binary files a/Modules/Segmentation/Resources/NewAdd_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Otsu.svg b/Modules/Segmentation/Resources/Otsu.svg new file mode 100644 index 0000000000..b95436c262 --- /dev/null +++ b/Modules/Segmentation/Resources/Otsu.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Otsu_48x48.png b/Modules/Segmentation/Resources/Otsu_48x48.png deleted file mode 100644 index a67ab936c6..0000000000 Binary files a/Modules/Segmentation/Resources/Otsu_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Paint.svg b/Modules/Segmentation/Resources/Paint.svg new file mode 100644 index 0000000000..d3b3a2ebc5 --- /dev/null +++ b/Modules/Segmentation/Resources/Paint.svg @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Paint_48x48.png b/Modules/Segmentation/Resources/Paint_48x48.png deleted file mode 100644 index 65d1fb394a..0000000000 Binary files a/Modules/Segmentation/Resources/Paint_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Paint_Cursor.svg b/Modules/Segmentation/Resources/Paint_Cursor.svg new file mode 100644 index 0000000000..868582cde7 --- /dev/null +++ b/Modules/Segmentation/Resources/Paint_Cursor.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Paint_Cursor_32x32.png b/Modules/Segmentation/Resources/Paint_Cursor_32x32.png deleted file mode 100644 index a7e90c1126..0000000000 Binary files a/Modules/Segmentation/Resources/Paint_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Pick_48x48.png b/Modules/Segmentation/Resources/Pick_48x48.png deleted file mode 100644 index df85a7a8eb..0000000000 Binary files a/Modules/Segmentation/Resources/Pick_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Picking.svg b/Modules/Segmentation/Resources/Picking.svg new file mode 100644 index 0000000000..b2f4eb849e --- /dev/null +++ b/Modules/Segmentation/Resources/Picking.svg @@ -0,0 +1,87 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/RegionGrowing.svg b/Modules/Segmentation/Resources/RegionGrowing.svg new file mode 100644 index 0000000000..7de4b45524 --- /dev/null +++ b/Modules/Segmentation/Resources/RegionGrowing.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/RegionGrowing_48x48.png b/Modules/Segmentation/Resources/RegionGrowing_48x48.png deleted file mode 100644 index e0e6c6e9dc..0000000000 Binary files a/Modules/Segmentation/Resources/RegionGrowing_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/RegionGrowing_Cursor.svg b/Modules/Segmentation/Resources/RegionGrowing_Cursor.svg new file mode 100644 index 0000000000..6920c99261 --- /dev/null +++ b/Modules/Segmentation/Resources/RegionGrowing_Cursor.svg @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/RegionGrowing_Cursor_32x32.png b/Modules/Segmentation/Resources/RegionGrowing_Cursor_32x32.png deleted file mode 100644 index cd5ce47f87..0000000000 Binary files a/Modules/Segmentation/Resources/RegionGrowing_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Subtract.svg b/Modules/Segmentation/Resources/Subtract.svg new file mode 100644 index 0000000000..3f35be692b --- /dev/null +++ b/Modules/Segmentation/Resources/Subtract.svg @@ -0,0 +1,104 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Subtract_48x48.png b/Modules/Segmentation/Resources/Subtract_48x48.png deleted file mode 100644 index c61d3e3690..0000000000 Binary files a/Modules/Segmentation/Resources/Subtract_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Subtract_Cursor.svg b/Modules/Segmentation/Resources/Subtract_Cursor.svg new file mode 100644 index 0000000000..ea85d6326f --- /dev/null +++ b/Modules/Segmentation/Resources/Subtract_Cursor.svg @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Subtract_Cursor_32x32.png b/Modules/Segmentation/Resources/Subtract_Cursor_32x32.png deleted file mode 100644 index 8c6be06ed6..0000000000 Binary files a/Modules/Segmentation/Resources/Subtract_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Templates/ToolCursor.svg b/Modules/Segmentation/Resources/Templates/ToolCursor.svg new file mode 100644 index 0000000000..48f25e7450 --- /dev/null +++ b/Modules/Segmentation/Resources/Templates/ToolCursor.svg @@ -0,0 +1,119 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Templates/ToolIcon.svg b/Modules/Segmentation/Resources/Templates/ToolIcon.svg new file mode 100644 index 0000000000..f23edcce3a --- /dev/null +++ b/Modules/Segmentation/Resources/Templates/ToolIcon.svg @@ -0,0 +1,103 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Threshold.svg b/Modules/Segmentation/Resources/Threshold.svg new file mode 100644 index 0000000000..ce379f1676 --- /dev/null +++ b/Modules/Segmentation/Resources/Threshold.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Threshold_48x48.png b/Modules/Segmentation/Resources/Threshold_48x48.png deleted file mode 100644 index d73bd74d02..0000000000 Binary files a/Modules/Segmentation/Resources/Threshold_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/TwoThresholds_48x48.png b/Modules/Segmentation/Resources/TwoThresholds_48x48.png deleted file mode 100644 index 81354ce68d..0000000000 Binary files a/Modules/Segmentation/Resources/TwoThresholds_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/ULThreshold.svg b/Modules/Segmentation/Resources/ULThreshold.svg new file mode 100644 index 0000000000..16a21b4009 --- /dev/null +++ b/Modules/Segmentation/Resources/ULThreshold.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Wipe.svg b/Modules/Segmentation/Resources/Wipe.svg new file mode 100644 index 0000000000..db1c84a1c3 --- /dev/null +++ b/Modules/Segmentation/Resources/Wipe.svg @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Wipe_48x48.png b/Modules/Segmentation/Resources/Wipe_48x48.png deleted file mode 100644 index b5b55b18dd..0000000000 Binary files a/Modules/Segmentation/Resources/Wipe_48x48.png and /dev/null differ diff --git a/Modules/Segmentation/Resources/Wipe_Cursor.svg b/Modules/Segmentation/Resources/Wipe_Cursor.svg new file mode 100644 index 0000000000..5322ac85cd --- /dev/null +++ b/Modules/Segmentation/Resources/Wipe_Cursor.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Segmentation/Resources/Wipe_Cursor_32x32.png b/Modules/Segmentation/Resources/Wipe_Cursor_32x32.png deleted file mode 100644 index c130dc00cf..0000000000 Binary files a/Modules/Segmentation/Resources/Wipe_Cursor_32x32.png and /dev/null differ diff --git a/Modules/Segmentation/files.cmake b/Modules/Segmentation/files.cmake index 6253ea9559..d6a3e2d648 100644 --- a/Modules/Segmentation/files.cmake +++ b/Modules/Segmentation/files.cmake @@ -1,112 +1,112 @@ set(CPP_FILES Algorithms/mitkCalculateSegmentationVolume.cpp Algorithms/mitkContourModelSetToImageFilter.cpp Algorithms/mitkContourSetToPointSetFilter.cpp Algorithms/mitkContourUtils.cpp Algorithms/mitkCorrectorAlgorithm.cpp Algorithms/mitkDiffImageApplier.cpp Algorithms/mitkDiffSliceOperation.cpp Algorithms/mitkDiffSliceOperationApplier.cpp Algorithms/mitkFeatureBasedEdgeDetectionFilter.cpp Algorithms/mitkImageLiveWireContourModelFilter.cpp Algorithms/mitkImageToContourFilter.cpp #Algorithms/mitkImageToContourModelFilter.cpp Algorithms/mitkImageToLiveWireContourFilter.cpp Algorithms/mitkManualSegmentationToSurfaceFilter.cpp Algorithms/mitkOtsuSegmentationFilter.cpp Algorithms/mitkSegmentationHelper.cpp Algorithms/mitkSegmentationObjectFactory.cpp Algorithms/mitkShapeBasedInterpolationAlgorithm.cpp Algorithms/mitkShowSegmentationAsSmoothedSurface.cpp Algorithms/mitkShowSegmentationAsSurface.cpp Algorithms/mitkVtkImageOverwrite.cpp Controllers/mitkSegmentationInterpolationController.cpp Controllers/mitkToolManager.cpp Controllers/mitkSegmentationModuleActivator.cpp Controllers/mitkToolManagerProvider.cpp DataManagement/mitkContour.cpp DataManagement/mitkContourSet.cpp DataManagement/mitkExtrudedContour.cpp Interactions/mitkAddContourTool.cpp Interactions/mitkAutoCropTool.cpp Interactions/mitkSegWithPreviewTool.cpp Interactions/mitkBinaryThresholdBaseTool.cpp Interactions/mitkBinaryThresholdTool.cpp Interactions/mitkBinaryThresholdULTool.cpp Interactions/mitkCloseRegionTool.cpp Interactions/mitkContourModelInteractor.cpp Interactions/mitkContourModelLiveWireInteractor.cpp Interactions/mitkEditableContourTool.cpp Interactions/mitkLiveWireTool2D.cpp Interactions/mitkLassoTool.cpp Interactions/mitkContourTool.cpp Interactions/mitkDrawPaintbrushTool.cpp Interactions/mitkErasePaintbrushTool.cpp Interactions/mitkEraseRegionTool.cpp Interactions/mitkFeedbackContourTool.cpp Interactions/mitkFillRegionBaseTool.cpp Interactions/mitkFillRegionTool.cpp Interactions/mitkOtsuTool3D.cpp Interactions/mitkPaintbrushTool.cpp Interactions/mitkRegionGrowingTool.cpp Interactions/mitkSegmentationsProcessingTool.cpp Interactions/mitkSegTool2D.cpp Interactions/mitkSubtractContourTool.cpp Interactions/mitkTool.cpp Interactions/mitkToolCommand.cpp Interactions/mitkPickingTool.cpp Interactions/mitknnUnetTool.cpp Interactions/mitkSegmentationInteractor.cpp #SO Interactions/mitkProcessExecutor.cpp Rendering/mitkContourMapper2D.cpp Rendering/mitkContourSetMapper2D.cpp Rendering/mitkContourSetVtkMapper3D.cpp Rendering/mitkContourVtkMapper3D.cpp SegmentationUtilities/BooleanOperations/mitkBooleanOperation.cpp SegmentationUtilities/MorphologicalOperations/mitkMorphologicalOperations.cpp #Added from ML Controllers/mitkSliceBasedInterpolationController.cpp Algorithms/mitkSurfaceStampImageFilter.cpp ) set(RESOURCE_FILES - Add_48x48.png - Add_Cursor_32x32.png - AI_48x48.png - AI_Cursor_32x32.png - Close_48x48.png - Close_Cursor_32x32.png - Erase_48x48.png - Erase_Cursor_32x32.png - Fill_48x48.png - Fill_Cursor_32x32.png - LiveWire_48x48.png - LiveWire_Cursor_32x32.png - NewAdd_48x48.png - NewAdd_Cursor_32x32.png - Otsu_48x48.png - Paint_48x48.png - Paint_Cursor_32x32.png - Pick_48x48.png - RegionGrowing_48x48.png - RegionGrowing_Cursor_32x32.png - Subtract_48x48.png - Subtract_Cursor_32x32.png - Threshold_48x48.png - TwoThresholds_48x48.png - Wipe_48x48.png - Wipe_Cursor_32x32.png + Add.svg + Add_Cursor.svg + AI.svg + AI_Cursor.svg + Close.svg + Close_Cursor.svg + Erase.svg + Erase_Cursor.svg + Fill.svg + Fill_Cursor.svg + LiveWire.svg + LiveWire_Cursor.svg + Lasso.svg + Lasso_Cursor.svg + Otsu.svg + Paint.svg + Paint_Cursor.svg + Picking.svg + RegionGrowing.svg + RegionGrowing_Cursor.svg + Subtract.svg + Subtract_Cursor.svg + Threshold.svg + ULThreshold.svg + Wipe.svg + Wipe_Cursor.svg Interactions/dummy.xml Interactions/EditableContourTool.xml Interactions/PickingTool.xml Interactions/MouseReleaseOnly.xml Interactions/PressMoveRelease.xml Interactions/PressMoveReleaseAndPointSetting.xml Interactions/PressMoveReleaseWithCTRLInversion.xml Interactions/PressMoveReleaseWithCTRLInversionAllMouseMoves.xml Interactions/SegmentationToolsConfig.xml Interactions/ContourModelModificationConfig.xml Interactions/ContourModelModificationInteractor.xml ) diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGIconClose.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGIconClose.png index c674c53dea..956c2a0c69 100644 Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGIconClose.png and b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGIconClose.png differ