Skip to content

Commit

Permalink
Add using ProportionalTimeGeometry to segmentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbolt committed Oct 25, 2023
1 parent edd1fc7 commit 847b446
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 10 deletions.
18 changes: 14 additions & 4 deletions Code/Source/sv4gui/Modules/QtWidgets/sv4gui_ResliceSlider.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ double sv4guiResliceSlider::getResliceSize()
return resliceSize;
}

// modify to use a ProportionalTimeGeometry object.
//
void sv4guiResliceSlider::updateReslice()
{
std::string msg = "[sv4guiResliceSlider::updateReslice] ";
std::cout << msg << "========== updateReslice ========== " << std::endl;

if(!isResliceOn()) return;

if(m_PathPoints.size()==0) return;
Expand All @@ -185,18 +190,22 @@ void sv4guiResliceSlider::updateReslice()
// currentSlicedGeometry=NULL;
// }

currentSlicedGeometry=sv4guiSegmentationUtils::CreateSlicedGeometry(m_PathPoints, baseData, resliceSize);
currentSlicedGeometry = sv4guiSegmentationUtils::CreateSlicedGeometry(m_PathPoints, baseData, resliceSize);
displayWidget->changeLayoutTo2x2Dand3DWidget();

mitk::SliceNavigationController::Pointer intensityController=intensityWindow->GetSliceNavigationController();
intensityController->SetInputWorldGeometry3D(currentSlicedGeometry);
intensityController->SetInputWorldTimeGeometry(currentSlicedGeometry);
//intensityController->SetInputWorldGeometry3D(currentSlicedGeometry);
intensityController->SetViewDirection(mitk::SliceNavigationController::Original);
intensityController->Update();

/*
mitk::SliceNavigationController::Pointer potentialController=potentialWindow->GetSliceNavigationController();
potentialController->SetInputWorldGeometry3D(currentSlicedGeometry);
potentialController->SetInputWorldGeometry(currentSlicedGeometry);
//potentialController->SetInputWorldGeometry3D(currentSlicedGeometry);
potentialController->SetViewDirection(mitk::SliceNavigationController::Original);
potentialController->Update();
*/
if(image)
{
mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
Expand Down Expand Up @@ -395,7 +404,8 @@ int sv4guiResliceSlider::GetSliceNumber()
if(currentSlicedGeometry.IsNull())
return 0;
else
return currentSlicedGeometry->GetSlices();
return currentSlicedGeometry->CountTimeSteps();
//return currentSlicedGeometry->GetSlices();
}

void sv4guiResliceSlider::moveToPathPosPoint(mitk::Point3D posPoint){
Expand Down
3 changes: 2 additions & 1 deletion Code/Source/sv4gui/Modules/QtWidgets/sv4gui_ResliceSlider.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ public slots:

QmitkStdMultiWidget* displayWidget=NULL;

mitk::SlicedGeometry3D::Pointer currentSlicedGeometry;
mitk::ProportionalTimeGeometry::Pointer currentSlicedGeometry;
//mitk::SlicedGeometry3D::Pointer currentSlicedGeometry;

QCheckBox* resliceCheckBox;
QmitkRenderWindow* intensityWindow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,25 @@ sv4guiSegmentationUtils::CreatePlaneGeometry(sv4guiPathElement::sv4guiPathPoint
// CreateSlicedGeometry
//----------------------
//
mitk::SlicedGeometry3D::Pointer sv4guiSegmentationUtils::CreateSlicedGeometry(std::vector<sv4guiPathElement::sv4guiPathPoint> pathPoints, mitk::BaseData* baseData, double size, bool useOnlyMinimumSpacing)
// [davep] modify to return a ProportionalTimeGeometry object.
//
mitk::ProportionalTimeGeometry::Pointer
//mitk::TimeGeometry::Pointer
//mitk::SlicedGeometry3D::Pointer
sv4guiSegmentationUtils::CreateSlicedGeometry(std::vector<sv4guiPathElement::sv4guiPathPoint> pathPoints,
mitk::BaseData* baseData, double size, bool useOnlyMinimumSpacing)
{
mitk::SlicedGeometry3D::Pointer slicedGeo3D=mitk::SlicedGeometry3D::New();

std::string msg = "[CreateSlicedGeometry] ";
std::cout << msg << "========== CreateSlicedGeometry ========== " << std::endl;

// Create a ProportionalTimeGeometry object to store a slicedGeo3D object.
auto prop_time_geom = mitk::ProportionalTimeGeometry::New();

mitk::SlicedGeometry3D::Pointer slicedGeo3D = mitk::SlicedGeometry3D::New();
slicedGeo3D->SetEvenlySpaced(false);
slicedGeo3D->InitializeSlicedGeometry(pathPoints.size());
mitk::Image* image=dynamic_cast<mitk::Image*>(baseData);
mitk::Image* image = dynamic_cast<mitk::Image*>(baseData);

for (int i = 0; i < pathPoints.size(); i++) {
mitk::PlaneGeometry::Pointer planegeometry = CreatePlaneGeometry(pathPoints[i], baseData,
Expand All @@ -360,7 +373,20 @@ mitk::SlicedGeometry3D::Pointer sv4guiSegmentationUtils::CreateSlicedGeometry(st
slicedGeo3D->SetOrigin(geometry->GetOrigin());
slicedGeo3D->SetIndexToWorldTransform(geometry->GetIndexToWorldTransform());
}
return slicedGeo3D;

prop_time_geom->Initialize(slicedGeo3D, 1);

// This causes a segfault using the new extrnals.
std::cout << msg << "########### clone ... " << std::endl;
auto cgeom = slicedGeo3D->Clone();
//mitk::BaseGeometry::Pointer cgeom = slicedGeo3D->Clone();





return prop_time_geom;
//return slicedGeo3D;
}

//---------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class SV4GUIMODULESEGMENTATION_EXPORT sv4guiSegmentationUtils

static mitk::PlaneGeometry::Pointer CreatePlaneGeometry(sv4guiPathElement::sv4guiPathPoint pathPoint, mitk::BaseData* baseData, double size, bool useOnlyMinimumSpacing = false);

static mitk::SlicedGeometry3D::Pointer CreateSlicedGeometry(std::vector<sv4guiPathElement::sv4guiPathPoint> pathPoints, mitk::BaseData* baseData, double size, bool useOnlyMinimumSpacing = false);
static mitk::ProportionalTimeGeometry::Pointer CreateSlicedGeometry(std::vector<sv4guiPathElement::sv4guiPathPoint> pathPoints, mitk::BaseData* baseData, double size, bool useOnlyMinimumSpacing = false);
//static mitk::SlicedGeometry3D::Pointer CreateSlicedGeometry(std::vector<sv4guiPathElement::sv4guiPathPoint> pathPoints, mitk::BaseData* baseData, double size, bool useOnlyMinimumSpacing = false);


static mitk::Image::Pointer GetSliceImage(const mitk::PlaneGeometry* planeGeometry, const mitk::Image* image, unsigned int timeStep = 0);
Expand Down

0 comments on commit 847b446

Please sign in to comment.