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 # ------------------------------------------------------------------------ */
28 #include "bbtkStaticLecture.h"
31 void bbtkStaticLecture::setPixelValue(int i, int j, int k, vtkImageData* img, double value)
34 int scalar_type = img->GetScalarType();
35 int* ext = img->GetExtent();
55 ap2 = (char *) img->GetScalarPointer(i,j,k);
58 case VTK_UNSIGNED_CHAR:
60 ap3 = (unsigned char *) img->GetScalarPointer(i,j,k);
61 *ap3 = (unsigned char) value;
65 ap4 = (short *) img->GetScalarPointer(i,j,k);
68 case VTK_UNSIGNED_SHORT:
70 ap5 = (unsigned short *) img->GetScalarPointer(i,j,k);
71 *ap5 = (unsigned short) value;
75 ap6 = (int *) img->GetScalarPointer(i,j,k);
78 case VTK_UNSIGNED_INT:
80 ap7 = (unsigned int *) img->GetScalarPointer(i,j,k);
81 *ap7 = (unsigned int) value;
85 ap8 = (long *) img->GetScalarPointer(i,j,k);
88 case VTK_UNSIGNED_LONG:
90 ap9 = (unsigned long *) img->GetScalarPointer(i,j,k);
91 *ap9 = (unsigned long) value;
95 ap10 = (float *) img->GetScalarPointer(i,j,k);
96 *ap10 = (float) value;
100 ap11 = (double *) img->GetScalarPointer(i,j,k);
101 *ap11 = (double) value;
105 double bbtkStaticLecture::getPixelValue(int i, int j, int k, vtkImageData* img)
108 int scalar_type = img->GetScalarType();
109 int* ext = img->GetExtent();
129 ap2 = (char *) img->GetScalarPointer(i,j,k);
132 case VTK_UNSIGNED_CHAR:
134 ap3 = (unsigned char *) img->GetScalarPointer(i,j,k);
139 ap4 = (short *) img->GetScalarPointer(i,j,k);
142 case VTK_UNSIGNED_SHORT:
143 unsigned short * ap5;
144 ap5 = (unsigned short *) img->GetScalarPointer(i,j,k);
149 ap6 = (int *) img->GetScalarPointer(i,j,k);
152 case VTK_UNSIGNED_INT:
154 ap7 = (unsigned int *) img->GetScalarPointer(i,j,k);
159 ap8 = (long *) img->GetScalarPointer(i,j,k);
162 case VTK_UNSIGNED_LONG:
164 ap9 = (unsigned long *) img->GetScalarPointer(i,j,k);
169 ap10 = (float *) img->GetScalarPointer(i,j,k);
170 rta = (double) *ap10;
174 ap11 = (double *) img->GetScalarPointer(i,j,k);
175 rta = (double) *ap11;