X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkMIPCreator.cxx;h=58ee8ae42ec02c5da30f1e1239a353239079f01f;hb=cda7ecf397be4449fc17b7b11444832b0250e3e4;hp=39d615f3651c207caba05d287534b158cce37fde;hpb=551b02f0819a98e9595a81570b1d1174f398f34d;p=bbtk.git diff --git a/packages/vtk/src/bbvtkMIPCreator.cxx b/packages/vtk/src/bbvtkMIPCreator.cxx index 39d615f..58ee8ae 100644 --- a/packages/vtk/src/bbvtkMIPCreator.cxx +++ b/packages/vtk/src/bbvtkMIPCreator.cxx @@ -1,58 +1,61 @@ -/*========================================================================= - +/*========================================================================= Program: bbtk Module: $RCSfile: bbvtkMIPCreator.cxx,v $ Language: C++ - Date: $Date: 2008/05/09 10:39:47 $ - Version: $Revision: 1.3 $ - - 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: 2010/04/08 14:37:59 $ + Version: $Revision: 1.7 $ =========================================================================*/ + +/* --------------------------------------------------------------------- + +* 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 */ - - #ifdef _USE_VTK_ - #include "bbvtkMIPCreator.h" #include "bbvtkPackage.h" namespace bbvtk { - - BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,MIPCreator) BBTK_BLACK_BOX_IMPLEMENTATION(MIPCreator,bbtk::AtomicBlackBox); - - - - - - void MIPCreator::bbUserConstructor() + + //--------------------------------------------------------------------- + void MIPCreator::bbUserSetDefaultValues() { - Init(); - bbSetInputShift(0); - bbSetInputScale(1.); + bbSetInputShift(0); + bbSetInputScale(1.0); + mCast = NULL; + mMIP = NULL; + mMapper = NULL; + mVolume = NULL; } - void MIPCreator::bbUserCopyConstructor() - { - Init(); - } - - void MIPCreator::Init() - { - + //--------------------------------------------------------------------- + void MIPCreator::bbUserInitializeProcessing() + { // Create the pipeline mCast = vtkImageShiftScale::New(); mCast->SetOutputScalarTypeToUnsignedChar(); @@ -69,25 +72,44 @@ namespace bbvtk mVolume->SetMapper(mMapper); // mMapper->ScalarVisibilityOff(); - // mMapper->ImmediateModeRenderingOn(); + // mMapper->ImmediateModeRenderingOn(); bbSetOutputOut(mVolume); } - void MIPCreator::bbUserDestructor() +//--------------------------------------------------------------------- + void MIPCreator::bbUserFinalizeProcessing() { - mCast->Delete(); - mMIP->Delete(); - mMapper->Delete(); - mVolume->Delete(); - + if (mCast!=NULL) + { + mCast->Delete(); + mCast=NULL; + } + + if (mMIP!=NULL) + { + mMIP->Delete(); + mMIP=NULL; + } + + if (mMapper!=NULL) + { + mMapper->Delete(); + mMapper=NULL; + } + + if (mVolume!=NULL) + { + mVolume->Delete(); + mVolume=NULL; + } } //--------------------------------------------------------------------- void MIPCreator::Process() { mCast->SetInput( bbGetInputIn() ); - mCast->SetScale( bbGetInputScale() / 100. ); + mCast->SetScale( bbGetInputScale() / 100.0 ); mCast->SetShift( -bbGetInputShift() ); mMapper->Update();