X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkImagePlanes.cxx;h=06253d0d93dead3af2bee24e9fff937a04136b4f;hb=310a70fea52f768e60d0a844e6ef84f13e4babd4;hp=4b0afe0f2d02e643d9b3678745b64834b55fd551;hpb=891b36528b2d4869edfcfea7ae5859968232b201;p=bbtk.git diff --git a/packages/vtk/src/bbvtkImagePlanes.cxx b/packages/vtk/src/bbvtkImagePlanes.cxx index 4b0afe0..06253d0 100644 --- a/packages/vtk/src/bbvtkImagePlanes.cxx +++ b/packages/vtk/src/bbvtkImagePlanes.cxx @@ -1,20 +1,33 @@ -/*========================================================================= - +/*========================================================================= Program: bbtk Module: $RCSfile: bbvtkImagePlanes.cxx,v $ Language: C++ - Date: $Date: 2008/10/14 08:53:14 $ - Version: $Revision: 1.8 $ - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/bbtk/License.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - + Date: $Date: 2008/11/27 16:38:32 $ + Version: $Revision: 1.13 $ =========================================================================*/ + +/* --------------------------------------------------------------------- + +* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) +* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux +* +* This software is governed by the CeCILL-B license under French law and +* abiding by the rules of distribution of free software. You can use, +* modify and/ or redistribute the software under the terms of the CeCILL-B +* license as circulated by CEA, CNRS and INRIA at the following URL +* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +* or in the file LICENSE.txt. +* +* As a counterpart to the access to the source code and rights to copy, +* modify and redistribute granted by the license, users are provided only +* with a limited warranty and the software's author, the holder of the +* economic rights, and the successive licensors have only limited +* liability. +* +* The fact that you are presently reading this means that you have had +* knowledge of the CeCILL-B license and that you accept its terms. +* ------------------------------------------------------------------------ */ + /** * \file * \brief @@ -50,13 +63,13 @@ namespace bbvtk namespace bbvtk { - BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,ImagePlanes) BBTK_BLACK_BOX_IMPLEMENTATION(ImagePlanes,bbtk::AtomicBlackBox); void ImagePlanes::bbUserConstructor() { planeWidgetX = planeWidgetY = planeWidgetZ = 0; + imageX = imageY = imageZ = 0; bbSetInputIn(0); std::vector vect; vect.push_back(512); @@ -64,13 +77,15 @@ namespace bbvtk bbSetInputWindowLevel (vect); } - void ImagePlanes::bbUserCopyConstructor() + void ImagePlanes::bbUserCopyConstructor(bbtk::BlackBox::Pointer) { planeWidgetX = planeWidgetY = planeWidgetZ = 0; + imageX = imageY = imageZ = 0; } void ImagePlanes::Init() - { + { + if (planeWidgetX != 0) return; // The shared picker enables us to use 3 planes at one time // and gets the picking order right @@ -128,18 +143,31 @@ namespace bbvtk int xMin, xMax, yMin, yMax, zMin, zMax; bbGetInputIn()->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax); + // Initial values : center of the volume (in real world, not in pixels!) + double xSpacing, ySpacing, zSpacing; + bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing); + planeWidgetX->SetInput(bbGetInputIn()); - planeWidgetX->SetPlaneOrientationToXAxes(); - planeWidgetX->SetSlicePosition((xMax+xMin)/2.); + planeWidgetX->SetPlaneOrientationToXAxes(); + planeWidgetX->SetSlicePosition((xMax+xMin)/2.*xSpacing); + planeWidgetX->GetResliceOutput()->Update(); + bbSetOutput("ImageX", planeWidgetX->GetResliceOutput()); + //planeWidgetX->GetResliceOutput()->Print(std::cout); planeWidgetY->SetInput(bbGetInputIn()); planeWidgetY->SetPlaneOrientationToYAxes(); - planeWidgetY->SetSlicePosition((yMax+yMin)/2.); - + planeWidgetY->SetSlicePosition((yMax+yMin)/2.*ySpacing); + planeWidgetY->GetResliceOutput()->Update(); + bbSetOutput("ImageY", planeWidgetY->GetResliceOutput()); + //planeWidgetY->GetResliceOutput()->Print(std::cout); + planeWidgetZ->SetInput(bbGetInputIn()); planeWidgetZ->SetPlaneOrientationToZAxes(); - planeWidgetZ->SetSlicePosition((zMax+zMin)/2.); - + planeWidgetZ->SetSlicePosition((zMax+zMin)/2.*zSpacing); + planeWidgetZ->GetResliceOutput()->Update(); + bbSetOutput("ImageZ", planeWidgetZ->GetResliceOutput()); + // planeWidgetZ->GetResliceOutput()->Print(std::cout); + // planeWidgetZ->SetWindowLevel(512,256); planeWidgetZ->SetWindowLevel(bbGetInputWindowLevel()[0],bbGetInputWindowLevel()[1]);