X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=inline;f=vv%2FvvCropDialog.cxx;h=682af4a5e01a0e2a3ac36c5d00fe6b88e8b469c6;hb=3378f6c372da1e07e35c45562749416fcfee6798;hp=af089dcb6f1dc8e2584a8800652b39cef0bfd01b;hpb=931a42358442f4ee4f314613c991c838d4b4e3b7;p=clitk.git
diff --git a/vv/vvCropDialog.cxx b/vv/vvCropDialog.cxx
index af089dc..682af4a 100644
--- a/vv/vvCropDialog.cxx
+++ b/vv/vvCropDialog.cxx
@@ -1,27 +1,20 @@
/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
- Program: vv
- Language: C++
- Author : Joel Schaerer (joel.schaerer@insa-lyon.fr)
+ 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
-Copyright (C) 2008
-Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
-CREATIS-LRMN 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.
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-=========================================================================*/
+ 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
+===========================================================================**/
#include
#include
#include
@@ -34,64 +27,63 @@ along with this program. If not, see .
#include "clitkCommon.h"
vvCropDialog::vvCropDialog(std::vector sms,int current) :
- mSlicerManagers(sms)
+ mSlicerManagers(sms)
{
- setupUi(this);
- for (unsigned int i=0;iaddItem(vtksys::SystemTools::GetFilenameName(mSlicerManagers[i]->GetFileName()).c_str());
- connect(inputSequenceBox,SIGNAL(currentIndexChanged(int)),this,SLOT(ImageChanged(int)));
- inputSequenceBox->setCurrentIndex(current);
- ImageChanged(current);
- connect(this,SIGNAL(accepted()),this,SLOT(ComputeCroppedImage()));
+ setupUi(this);
+ for (unsigned int i=0; iaddItem(vtksys::SystemTools::GetFilenameName(mSlicerManagers[i]->GetFileName()).c_str());
+ connect(inputSequenceBox,SIGNAL(currentIndexChanged(int)),this,SLOT(ImageChanged(int)));
+ inputSequenceBox->setCurrentIndex(current);
+ ImageChanged(current);
+ connect(this,SIGNAL(accepted()),this,SLOT(ComputeCroppedImage()));
}
void vvCropDialog::ImageChanged(int newindex)
{
- std::vector imsize=mSlicerManagers[newindex]->GetImage()->GetSize();
- xminSlider->setMaximum(imsize[0]-1);
- xmaxSlider->setMaximum(imsize[0]-1);
- xmaxSlider->setValue(imsize[0]-1);
- yminSlider->setMaximum(imsize[1]-1);
- ymaxSlider->setMaximum(imsize[1]-1);
- ymaxSlider->setValue(imsize[1]-1);
- zminSlider->setMaximum(imsize[2]-1);
- zmaxSlider->setMaximum(imsize[2]-1);
- zmaxSlider->setValue(imsize[2]-1);
- spin_xmin->setMaximum(imsize[0]-1);
- spin_xmax->setMaximum(imsize[0]-1);
- spin_xmax->setValue(imsize[0]-1);
- spin_ymin->setMaximum(imsize[1]-1);
- spin_ymax->setMaximum(imsize[1]-1);
- spin_ymax->setValue(imsize[1]-1);
- spin_zmin->setMaximum(imsize[2]-1);
- spin_zmax->setMaximum(imsize[2]-1);
- spin_zmax->setValue(imsize[2]-1);
+ std::vector imsize=mSlicerManagers[newindex]->GetImage()->GetSize();
+ xminSlider->setMaximum(imsize[0]-1);
+ xmaxSlider->setMaximum(imsize[0]-1);
+ xmaxSlider->setValue(imsize[0]-1);
+ yminSlider->setMaximum(imsize[1]-1);
+ ymaxSlider->setMaximum(imsize[1]-1);
+ ymaxSlider->setValue(imsize[1]-1);
+ zminSlider->setMaximum(imsize[2]-1);
+ zmaxSlider->setMaximum(imsize[2]-1);
+ zmaxSlider->setValue(imsize[2]-1);
+ spin_xmin->setMaximum(imsize[0]-1);
+ spin_xmax->setMaximum(imsize[0]-1);
+ spin_xmax->setValue(imsize[0]-1);
+ spin_ymin->setMaximum(imsize[1]-1);
+ spin_ymax->setMaximum(imsize[1]-1);
+ spin_ymax->setValue(imsize[1]-1);
+ spin_zmin->setMaximum(imsize[2]-1);
+ spin_zmax->setMaximum(imsize[2]-1);
+ spin_zmax->setValue(imsize[2]-1);
}
void vvCropDialog::ComputeCroppedImage()
{
- QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
- mResult=vvImage::New();
- vvSlicerManager * current=mSlicerManagers[inputSequenceBox->currentIndex()];
- vvImage::Pointer image=current->GetImage();
- for (std::vector::const_iterator i=image->GetVTKImages().begin();
- i!=image->GetVTKImages().end();i++)
- {
- vtkSmartPointer filter=vtkSmartPointer::New();
- ///Vtk is very weird, you need to "translate the extent" to get the correct origin
- //http://markmail.org/message/vndc2tr6kcabiakp#query:vtkImageClip%20origin+page:1+mid:6na7y57floutklvz+state:results
- vtkSmartPointer translate=vtkSmartPointer::New();
- filter->SetInput(*i);
- filter->SetOutputWholeExtent(xminSlider->value(),xmaxSlider->value(),
- yminSlider->value(),ymaxSlider->value(),
- zminSlider->value(),zmaxSlider->value());
- translate->SetTranslation(-xminSlider->value(),-yminSlider->value(),-zminSlider->value());
- translate->SetInput(filter->GetOutput());
- filter->ClipDataOn(); //Really create a cropped copy of the image
- translate->Update();
- vtkImageData* output=vtkImageData::New();
- output->ShallowCopy(translate->GetOutput());
- mResult->AddImage(output);
- }
- QApplication::restoreOverrideCursor();
+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
+ mResult=vvImage::New();
+ vvSlicerManager * current=mSlicerManagers[inputSequenceBox->currentIndex()];
+ vvImage::Pointer image=current->GetImage();
+ for (std::vector::const_iterator i=image->GetVTKImages().begin();
+ i!=image->GetVTKImages().end(); i++) {
+ vtkSmartPointer filter=vtkSmartPointer::New();
+ ///Vtk is very weird, you need to "translate the extent" to get the correct origin
+ //http://markmail.org/message/vndc2tr6kcabiakp#query:vtkImageClip%20origin+page:1+mid:6na7y57floutklvz+state:results
+ vtkSmartPointer translate=vtkSmartPointer::New();
+ filter->SetInput(*i);
+ filter->SetOutputWholeExtent(xminSlider->value(),xmaxSlider->value(),
+ yminSlider->value(),ymaxSlider->value(),
+ zminSlider->value(),zmaxSlider->value());
+ translate->SetTranslation(-xminSlider->value(),-yminSlider->value(),-zminSlider->value());
+ translate->SetInput(filter->GetOutput());
+ filter->ClipDataOn(); //Really create a cropped copy of the image
+ translate->Update();
+ vtkImageData* output=vtkImageData::New();
+ output->ShallowCopy(translate->GetOutput());
+ mResult->AddImage(output);
+ }
+ QApplication::restoreOverrideCursor();
}