2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------
27 #include "bbPackRecalageReSlicerBox.h"
28 #include "bbPackRecalagePackage.h"
30 namespace bbPackRecalage
33 BBTK_ADD_BLACK_BOX_TO_PACKAGE(PackRecalage,ReSlicerBox)
34 BBTK_BLACK_BOX_IMPLEMENTATION(ReSlicerBox,bbtk::AtomicBlackBox);
35 void ReSlicerBox::Process()
37 if(!bbGetInputOrigin().empty() && bbGetInputTransform() != NULL)
39 //image = vtkImageChangeInformation::New();
40 image->SetInput( bbGetInputIn() );
41 image->SetOutputSpacing( 1,1,1 );
43 if(bbGetInputCentered())
45 image->CenterImageOn();
48 //slicer =vtkImageReslice::New();
49 slicer->SetInput( image->GetOutput() );
50 slicer->SetInformationInput( image->GetOutput() );
51 slicer->SetResliceTransform(bbGetInputTransform());
52 slicer->SetOutputOrigin( -(bbGetInputOrigin()[0]) , -(bbGetInputOrigin()[1]) , -(bbGetInputOrigin()[2]) );
53 if(bbGetInputInterpolate())
55 slicer->InterpolateOn();
59 //imageResult = vtkImageChangeInformation::New();
60 imageResult->SetInput( slicer->GetOutput() );
62 bbGetInputIn()->GetSpacing(spc);
63 imageResult->SetOutputSpacing( spc );
64 imageResult->SetOutputOrigin( 0,0,0 );
66 bbSetOutputOut( imageResult->GetOutput() );
70 bbSetOutputOut( NULL );
73 void ReSlicerBox::bbUserSetDefaultValues()
75 std::vector<int> empty;
76 bbSetInputOrigin(empty);
78 bbSetInputTransform(NULL);
80 bbSetInputCentered(false);
81 bbSetInputInterpolate(false);
84 void ReSlicerBox::bbUserInitializeProcessing()
87 // THE INITIALIZATION METHOD BODY :
89 // but this is where you should allocate the internal/output pointers
91 image = vtkImageChangeInformation::New();
92 slicer =vtkImageReslice::New();
93 imageResult = vtkImageChangeInformation::New();
95 void ReSlicerBox::bbUserFinalizeProcessing()
99 imageResult->Delete();
102 // EO namespace bbPackRecalage