2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
29 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
31 #include "bbvtkImageVtkProperties.h"
32 #include "bbvtkPackage.h"
36 BBTK_ADD_BLACK_BOX_TO_PACKAGE(vtk,ImageVtkProperties)
37 BBTK_BLACK_BOX_IMPLEMENTATION(ImageVtkProperties,bbtk::AtomicBlackBox);
39 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
41 void ImageVtkProperties::Process()
49 int numberoOfComponents;
50 std::vector<int> vsize;
51 std::vector<double> vspacing;
52 std::vector<double> vrange;
53 std::vector<double> vorigin;
57 bbGetInputIn()->Modified();
58 //EED 2017-01-01 Migration VTK7
59 #if (VTK_MAJOR_VERSION <= 5)
60 bbGetInputIn()->Update();
61 bbGetInputIn()->GetWholeExtent(ext);
63 #if (VTK_MAJOR_VERSION >= 6)
64 bbGetInputIn()->GetExtent(ext);
67 vsize.push_back(ext[1]-ext[0]+1);
68 vsize.push_back(ext[3]-ext[2]+1);
69 vsize.push_back(ext[5]-ext[4]+1);
71 if (vsize[0]>1) dim++;
72 if (vsize[1]>1) dim++;
73 if (vsize[2]>1) dim++;
74 bbGetInputIn()->GetScalarRange(range);
75 bbGetInputIn()->GetOrigin(origin);
76 numberoOfComponents=bbGetInputIn()->GetNumberOfScalarComponents();
77 bbGetInputIn()->GetSpacing(spc);
78 for (unsigned int i=0;i<dim;++i)
80 vspacing.push_back( (double)spc[i] );
81 vorigin.push_back( (double)origin[i] );
83 vrange.push_back((double)range[0]);
84 vrange.push_back((double)range[1]);
85 if (bbGetInputIn()->GetScalarType()==VTK_BIT) nametype="VTK_BIT"; // 1
86 if (bbGetInputIn()->GetScalarType()==VTK_CHAR) nametype="VTK_CHAR"; // 2
87 if (bbGetInputIn()->GetScalarType()==VTK_SIGNED_CHAR) nametype="VTK_SIGNED_CHAR"; // 15
88 if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_CHAR) nametype="VTK_UNSIGNED_CHAR"; // 3
89 if (bbGetInputIn()->GetScalarType()==VTK_SHORT) nametype="VTK_SHORT"; // 4
90 if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_SHORT) nametype="VTK_UNSIGNED_SHORT"; // 5
91 if (bbGetInputIn()->GetScalarType()==VTK_INT) nametype="VTK_INT"; // 6
92 if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_INT) nametype="VTK_UNSIGNED_INT"; // 7
93 if (bbGetInputIn()->GetScalarType()==VTK_LONG) nametype="VTK_LONG"; // 8
94 if (bbGetInputIn()->GetScalarType()==VTK_UNSIGNED_LONG) nametype="VTK_UNSIGNED_LONG"; // 9
95 if (bbGetInputIn()->GetScalarType()==VTK_FLOAT) nametype="VTK_FLOAT"; // 10
96 if (bbGetInputIn()->GetScalarType()==VTK_DOUBLE) nametype="VTK_DOUBLE"; // 11
99 numberoOfComponents = 0;
103 vspacing.push_back(0);
104 vspacing.push_back(0);
105 vspacing.push_back(0);
110 bbSetOutputDimension ( dim );
111 bbSetOutputOrigin ( vorigin );
112 bbSetOutputSize ( vsize );
113 bbSetOutputSpacing ( vspacing );
114 bbSetOutputMinMax ( vrange );
115 bbSetOutputTypeName ( nametype );
116 bbSetOutputComponents ( numberoOfComponents );
119 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
121 void ImageVtkProperties::bbUserSetDefaultValues()
124 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
125 // Here we initialize the input 'In' to 0
130 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
132 void ImageVtkProperties::bbUserInitializeProcessing()
135 // THE INITIALIZATION METHOD BODY :
137 // but this is where you should allocate the internal/output pointers
143 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
145 void ImageVtkProperties::bbUserFinalizeProcessing()
148 // THE FINALIZATION METHOD BODY :
150 // but this is where you should desallocate the internal/output pointers
155 // EO namespace bbvtk