From: dsarrut Date: Thu, 9 Jun 2011 12:35:51 +0000 (+0200) Subject: Merge branch 'master' of /home/dsarrut/clitk3.server X-Git-Tag: v1.3.0~321^2~3^2~2 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=651f624f17e3f6b09623e6236404a88a748b9bdf;hp=703487ce9c727034bddad25e1b33750a835f7caf;p=clitk.git Merge branch 'master' of /home/dsarrut/clitk3.server --- diff --git a/tools/clitkCropImageGenericFilter.cxx b/tools/clitkCropImageGenericFilter.cxx index 5c78d4e..aeae1f9 100644 --- a/tools/clitkCropImageGenericFilter.cxx +++ b/tools/clitkCropImageGenericFilter.cxx @@ -165,14 +165,21 @@ namespace clitk output->SetOrigin(origin); } - // force index to zero - typename ImageType::RegionType region; - region = output->GetLargestPossibleRegion(); - typename ImageType::IndexType index; + // adjust image origin and force index to zero + typename ImageType::RegionType region = output->GetLargestPossibleRegion(); + typename ImageType::IndexType index = region.GetIndex(); + typename ImageType::PointType origin = output->GetOrigin(); + typename ImageType::SpacingType spacing = output->GetSpacing(); + if (mArgsInfo.verbose_flag) std::cout << "origin before crop " << origin << std::endl; + for (unsigned int i = 0; i < output->GetImageDimension(); i++) + origin[i] += index[i]*spacing[i]; + if (mArgsInfo.verbose_flag) std::cout << "origin after crop " << origin << std::endl; + output->SetOrigin(origin); + index.Fill(itk::NumericTraits::Zero); region.SetIndex(index); output->SetRegions(region); - + // Write/Save results this->template SetNextOutput(output); } diff --git a/vv/icons/identity.png b/vv/icons/identity.png new file mode 100644 index 0000000..dbce16d Binary files /dev/null and b/vv/icons/identity.png differ diff --git a/vv/vvIcons.qrc b/vv/vvIcons.qrc index 9dd0d96..15a8648 100644 --- a/vv/vvIcons.qrc +++ b/vv/vvIcons.qrc @@ -39,5 +39,6 @@ icons/adjustsize.png icons/standardbutton-apply-16.png icons/standardbutton-cancel-16.png + icons/identity.png diff --git a/vv/vvInfoPanel.cxx b/vv/vvInfoPanel.cxx index da2bda3..e8d3ba8 100644 --- a/vv/vvInfoPanel.cxx +++ b/vv/vvInfoPanel.cxx @@ -122,55 +122,6 @@ void vvInfoPanel::setCurrentInfo(int visibility, double x, double y, double z, d //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -void vvInfoPanel::setViews(int window, int view, int slice) -{/* - QString viewString; - switch (view) { - case 0: { - viewString = "Sagital, "; - break; - } - case 1: { - viewString = "Coronal, "; - break; - } - case 2: { - viewString = "Axial, "; - break; - } - } - - QString text = viewString; - if (view != -1) { - text += "current slice : "; - text += QString::number(slice); - } else { - text = "Disable"; - } - - switch (window) { - case 0: { - ULLabel->setText(text); - break; - } - case 1: { - URLabel->setText(text); - break; - } - case 2: { - DLLabel->setText(text); - break; - } - case 3: { - DRLabel->setText(text); - break; - } - }*/ -} -//------------------------------------------------------------------------------ - - //------------------------------------------------------------------------------ void vvInfoPanel::setMemoryInMb(QString text) { diff --git a/vv/vvInfoPanel.h b/vv/vvInfoPanel.h index 5418703..4a665e1 100644 --- a/vv/vvInfoPanel.h +++ b/vv/vvInfoPanel.h @@ -39,7 +39,6 @@ public: void setDimension(QString text); void setSizePixel(QString text); void setCurrentInfo(int visibility, double x, double y, double z, double X, double Y, double Z, double value); - void setViews(int window, int view, int slice); void setMemoryInMb(QString text); public slots: diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 07e0279..882bc2b 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -160,6 +160,11 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(SelectFusionImage())); contextActions.push_back(actionAdd_fusion_image); + contextMenu.addSeparator(); + QAction* actionResetMatrix = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/identity.png")), + tr("Reset transformation to identity")); + connect(actionResetMatrix, SIGNAL(triggered()), this,SLOT(ResetTransformationToIdentity())); + // TRIAL DS /* QMenu * m = new QMenu(menubar); @@ -910,8 +915,6 @@ void vvMainWindow::LoadImages(std::vector files, vvImageReader::Loa this, SLOT(OverlayChanged(int,double,double))); connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)), this, SLOT(FusionChanged(int,double))); - connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)), - this,SLOT(WindowsChanged(int, int, int))); connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)), this,SLOT(WindowLevelChanged(double, double, int, int))); connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)), @@ -1625,13 +1628,6 @@ void vvMainWindow::FusionChanged(int visibility, double value) } //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -void vvMainWindow::WindowsChanged(int window, int view, int slice) -{ - infoPanel->setViews(window, view, slice); -} -//------------------------------------------------------------------------------ - //------------------------------------------------------------------------------ void vvMainWindow::WindowLevelChanged(double window, double level,int preset,int colormap) { @@ -1912,6 +1908,16 @@ void vvMainWindow::SelectFusionImage() } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvMainWindow::ResetTransformationToIdentity() +{ + std::string actorType = DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString().toStdString(); + int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); + mSlicerManagers[index]->ResetTransformationToIdentity(actorType); + ImageInfoChanged(); +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::AddFusionImage(int index, QString file) { @@ -2831,8 +2837,6 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen this, SLOT(OverlayChanged(int,double,double))); connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)), this, SLOT(FusionChanged(int,double))); - connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)), - this,SLOT(WindowsChanged(int, int, int))); connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)), this,SLOT(WindowLevelChanged(double, double, int, int))); connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)), diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index d47dacc..7da8a91 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -101,7 +101,6 @@ public slots: void SegmentationOnCurrentImage(); void SurfaceViewerLaunch(); - void WindowsChanged(int window, int view, int slice); void WindowLevelChanged(double window, double level,int preset, int colormap); void UpdateSlice(int slicer, int slice); void UpdateTSlice(int slicer, int slice); @@ -140,6 +139,7 @@ public slots: void OpenField(); void SelectOverlayImage(); void SelectFusionImage(); + void ResetTransformationToIdentity(); void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b); void SetOverlayProperty(int color); @@ -211,6 +211,4 @@ private: }; -#include "vvMainWindow.txx" - #endif diff --git a/vv/vvMainWindow.txx b/vv/vvMainWindow.txx deleted file mode 100644 index 7cdb613..0000000 --- a/vv/vvMainWindow.txx +++ /dev/null @@ -1,18 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -===========================================================================**/ -// } diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 4358357..6100c56 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -836,8 +836,8 @@ void vvSlicer::UpdateDisplayExtent() // Overlay image actor if (mOverlay && mOverlayActor->GetVisibility()) { + AdjustResliceToSliceOrientation(mOverlayReslice); int overExtent[6]; - mOverlayReslice->GetOutput()->UpdateInformation(); this->ConvertImageToImageDisplayExtent(input, w_ext, mOverlayReslice->GetOutput(), overExtent); ClipDisplayedExtent(overExtent, mOverlayMapper->GetInput()->GetWholeExtent()); mOverlayActor->SetDisplayExtent( overExtent ); @@ -845,8 +845,8 @@ void vvSlicer::UpdateDisplayExtent() // Fusion image actor if (mFusion && mFusionActor->GetVisibility()) { + AdjustResliceToSliceOrientation(mFusionReslice); int fusExtent[6]; - mFusionReslice->GetOutput()->UpdateInformation(); this->ConvertImageToImageDisplayExtent(input, w_ext, mFusionReslice->GetOutput(), fusExtent); ClipDisplayedExtent(fusExtent, mFusionMapper->GetInput()->GetWholeExtent()); mFusionActor->SetDisplayExtent(fusExtent); diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 987162c..fd8f09f 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -736,6 +736,27 @@ double vvSlicerManager::GetColorLevel() } //---------------------------------------------------------------------------- +//------------------------------------------------------------------------------ +void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType) +{ + if(actorType == "image") + this->GetImage()->GetTransform()->Identity(); + else if(actorType == "overlay") + this->GetSlicer(0)->GetOverlay()->GetTransform()->Identity(); + else if(actorType == "fusion") + this->GetSlicer(0)->GetFusion()->GetTransform()->Identity(); + else if(actorType == "vf") + this->GetVF()->GetTransform()->Identity(); + else + return; + + for(int i=0; i< this->GetNumberOfSlicers(); i++){ + this->GetSlicer(i)->ForceUpdateDisplayExtent(); + this->GetSlicer(i)->ResetCamera(); + this->GetSlicer(i)->Render(); + } +} +//------------------------------------------------------------------------------ //---------------------------------------------------------------------------- void vvSlicerManager::Render() diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index a148d19..5e0ef60 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -166,6 +166,7 @@ class vvSlicerManager : public QObject { void UpdateViews(int current, int slicer); void UpdateLinked(int slicer); void UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate=false); + void ResetTransformationToIdentity(const std::string actorType); void Render(); void AddLink(std::string newId) { @@ -211,7 +212,6 @@ signals : void UpdateVector(int display, double x, double y, double z, double value); void UpdateOverlay(int display, double valueOver, double valueRef); void UpdateFusion(int display, double valueFus); - void UpdateWindows(int slicer, int view, int slice); void UpdateOrientation(int slicer, int orientation); void UpdateSlice(int slicer, int slice); void UpdateTSlice(int slicer, int slice);