]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbcreaMaracasVisuSliceImage.cxx
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / bbtk / src / bbcreaMaracasVisuSliceImage.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 #include "bbcreaMaracasVisuSliceImage.h"
27 #include "bbcreaMaracasVisuPackage.h"
28 namespace bbcreaMaracasVisu
29 {
30
31         
32         
33 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,SliceImage)
34 BBTK_BLACK_BOX_IMPLEMENTATION(SliceImage,bbtk::AtomicBlackBox);
35 void SliceImage::Process()
36 {
37         //printf("EED 0 SliceImage::Process \n");
38         vtkImageData *imagedata=NULL;
39
40         //std::cout<<"MSJ: test SliceImage::Process()"<<this<<std::endl;
41         if ( bbGetInputIn()!=NULL ){
42
43           imageReslice->SetInput( bbGetInputIn() );
44           imageReslice->SetInformationInput(bbGetInputIn() );
45           imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
46           imageReslice->SetResliceAxesOrigin(0,0, bbGetInputZ()*bbGetInputIn()->GetSpacing()[2] );
47           imageReslice->SetOutputDimensionality(2);
48           imageReslice->SetInterpolationModeToLinear();
49            imagedata = imageReslice->GetOutput();
50           imagedata->Update();
51           imagedata->UpdateInformation();       
52           //printf("EED 1 SliceImage::Process %p\n", imagedata);
53   }
54   bbSetOutputOut( imagedata );
55 }
56         
57         
58         //-----------------------------------------------------------------     
59         void SliceImage::bbUserSetDefaultValues()
60         {
61                 bbSetInputIn(NULL);
62                 bbSetInputZ(0);
63                 imageReslice=NULL;
64         }
65         
66         //-----------------------------------------------------------------     
67         void SliceImage::bbUserInitializeProcessing()
68         {
69                 imageReslice = vtkImageReslice::New();
70         }
71         
72         //-----------------------------------------------------------------     
73         void SliceImage::bbUserFinalizeProcessing()
74         {
75         }
76         
77         //-----------------------------------------------------------------     
78         
79         
80 }
81 // EO namespace bbcreaMaracasVisu
82
83