From e3bebab82ea2de9ae3a2d2418195be7076b00b2c Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Thu, 26 May 2011 15:16:48 +0200 Subject: [PATCH] solved bug 316 - also refactored the code a bit... --- vv/vvMainWindow.cxx | 79 +++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 56 deletions(-) diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 995d3de..00e7e1a 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -1064,70 +1064,35 @@ void vvMainWindow::ImageInfoChanged() vvImage::Pointer imageSelected; if (DataTree->topLevelItem(index) == DataTree->selectedItems()[0]) { imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetImage(); - dimension = imageSelected->GetNumberOfDimensions(); - origin.resize(dimension); - inputSpacing.resize(dimension); - inputSize.resize(dimension); - sizeMM.resize(dimension); - pixelType = mSlicerManagers[index]->GetImage()->GetScalarTypeAsITKString().c_str(); - for (int i = 0; i < dimension; i++) { - origin[i] = imageSelected->GetOrigin()[i]; - inputSpacing[i] = imageSelected->GetSpacing()[i]; - inputSize[i] = imageSelected->GetSize()[i]; - sizeMM[i] = inputSize[i]*inputSpacing[i]; - NPixel *= inputSize[i]; - } - inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000); } else if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "vector") { imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetVF(); - dimension = imageSelected->GetNumberOfDimensions(); - origin.resize(dimension); - inputSpacing.resize(dimension); - inputSize.resize(dimension); - sizeMM.resize(dimension); - pixelType = mSlicerManagers[index]->GetVF()->GetScalarTypeAsITKString().c_str(); - for (int i = 0; i < dimension; i++) { - origin[i] = imageSelected->GetOrigin()[i]; - inputSpacing[i] = imageSelected->GetSpacing()[i]; - inputSize[i] = imageSelected->GetSize()[i]; - sizeMM[i] = inputSize[i]*inputSpacing[i]; - NPixel *= inputSize[i]; - } - inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000); } else if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "overlay") { imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetOverlay(); - dimension = imageSelected->GetNumberOfDimensions(); - origin.resize(dimension); - inputSpacing.resize(dimension); - inputSize.resize(dimension); - sizeMM.resize(dimension); - pixelType = mSlicerManagers[index]->GetImage()->GetScalarTypeAsITKString().c_str(); - for (int i = 0; i < dimension; i++) { - origin[i] = imageSelected->GetOrigin()[i]; - inputSpacing[i] = imageSelected->GetSpacing()[i]; - inputSize[i] = imageSelected->GetSize()[i]; - sizeMM[i] = inputSize[i]*inputSpacing[i]; - NPixel *= inputSize[i]; - } - inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000); } else if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "fusion") { imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetFusion(); - dimension = imageSelected->GetNumberOfDimensions(); - origin.resize(dimension); - inputSpacing.resize(dimension); - inputSize.resize(dimension); - sizeMM.resize(dimension); - pixelType = mSlicerManagers[index]->GetImage()->GetScalarTypeAsITKString().c_str(); - for (int i = 0; i < dimension; i++) { - origin[i] = imageSelected->GetOrigin()[i]; - inputSpacing[i] = imageSelected->GetSpacing()[i]; - inputSize[i] = imageSelected->GetSize()[i]; - sizeMM[i] = inputSize[i]*inputSpacing[i]; - NPixel *= inputSize[i]; - } - inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000); + } + else if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "contour") { + imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetImage(); + } + else { + imageSelected = mSlicerManagers[index]->GetSlicer(0)->GetImage(); } + dimension = imageSelected->GetNumberOfDimensions(); + origin.resize(dimension); + inputSpacing.resize(dimension); + inputSize.resize(dimension); + sizeMM.resize(dimension); + pixelType = mSlicerManagers[index]->GetImage()->GetScalarTypeAsITKString().c_str(); + for (int i = 0; i < dimension; i++) { + origin[i] = imageSelected->GetOrigin()[i]; + inputSpacing[i] = imageSelected->GetSpacing()[i]; + inputSize[i] = imageSelected->GetSize()[i]; + sizeMM[i] = inputSize[i]*inputSpacing[i]; + NPixel *= inputSize[i]; + } + inputSizeInBytes = GetSizeInBytes(imageSelected->GetActualMemorySize()*1000); + QString dim = QString::number(dimension) + " ("; dim += pixelType + ")"; @@ -1138,7 +1103,9 @@ void vvMainWindow::ImageInfoChanged() infoPanel->setOrigin(GetVectorDoubleAsString(origin)); infoPanel->setSpacing(GetVectorDoubleAsString(inputSpacing)); infoPanel->setNPixel(QString::number(NPixel)+" ("+inputSizeInBytes+")"); + std::cout << "Will get transform " << std::endl; transformation = imageSelected->GetTransform()->GetMatrix(); + std::cout << "Got transform " << std::endl; infoPanel->setTransformation(Get4x4MatrixDoubleAsString(transformation)); landmarksPanel->SetCurrentLandmarks(mSlicerManagers[index]->GetLandmarks(), -- 2.47.1