[vtkusers] get the point intensity?
Laurent Mundeleer
lmundele at ulb.ac.be
Wed Feb 4 05:56:05 EST 2004
Hi,
I use VC++, and I still have a problem with the functions obtaining
scalars values in images.
I'd like to calculate it in one time with GetScalars, but I've an error
saying this :
"
ERROR: In C:\vtk\vtksrc\Common\vtkImageData.cxx, line 1571
vtkImageData (0x05571A40): GetScalarPointer: Pixel (362, 371, 1) not in
memory.
Current extent= (0, 668, 0, 658, 0, 0)
ERROR: In C:\vtk\vtksrc\Common\vtkImageData.cxx, line 1571
vtkImageData (0x05571A40): GetScalarPointer: Pixel (362, 371, 2) not in
memory.
Current extent= (0, 668, 0, 658, 0, 0)
....
"
Here's the code :
when charging the image volume :
...
valeursImage = (vtkFloatArray*)
mapper->GetScalars(src->GetOutput(),0,0,0,0,*component);
...
/************************ test fonction with positions[0] : x ,
positions[1] : y
void affichageBase::testValues()
{
if (mapper->GetInput()->GetScalarPointer() != NULL)
{
float res;
for (int i = 0; i< 20 ; i++)
{
res =
mapper->GetInput()->GetScalarComponentAsFloat(positions[0],
positions[1], i, 0);
cout<<"val res : "<<res<<" en " <<positions[0]<<" , "
<<positions[1]<<" , " <<i<<endl;
cout<<"val component :
"<<valeursImage->GetComponent(mapper->GetInput()->FindPoint(positions[0],
positions[1], i) ,0)<<" en " <<positions[0]<<" , " <<positions[1]<<" , "
<<i<<endl;
}
}
}
******************************/
The output of this code is :
"
val res : 255 en 367 , 344 , 0
val component : 24 en 367 , 344 , 0
val res : 0 en 367 , 344 , 1
val component : 3.94606e-042 en 367 , 344 , 1
val res : 0 en 367 , 344 , 2
val component : 3.94606e-042 en 367 , 344 , 2
val res : 0 en 367 , 344 , 3
...
"
So, first, the values for the point of the image ont the screen are
different with the two methodes. Are the IDs unique?
Secondly, I've NULL values for the images who aren't rendered.
What should I do?
thanks
Laurent
PS : sorry for the preview message with truncated title
--
********************************************
Laurent Mundeleer
Université Libre de Bruxelles (ULB)
Service des Systèmes Logiques et Numériques (SLN) CP165/57
50, Av. F.Roosevelt
1050 Bruxelles
Belgium
tel : ++32.2.650.22.97
fax : ++32.2.650.22.98
e-mail : lmundele at ulb.ac.be
********************************************
Vidyadhar wrote:
>Hi,
>That function is intended for TCL usage. Are you using VTK with TCL? I use
>VC++. Generally there are two different types of data associated with a
>dataset object (vtkImageData is derived from it). These are celldata and
>pointdata. In each case there could be scalars, normals, tensors, etc. data.
>Actual data could be bit, byte, short int, int, long and float. In C++ one
>can obtain these pointers and typecast to appropriate type and access data
>in these arrays using IDs. I think this kind of typecasting cannot be done
>in TCL so one uses GetScalarComponentAsFloat. The TCL wrapper will get array
>pointer, typecast it, obtain ID (using x,y,z values and FindPoint()), access
>correct array element, convert it to float and return it. I hope this helps.
>Vidyadhar
>----- Original Message -----
>From: "Laurent Mundeleer" <lmundele at ulb.ac.be>
>To: "Vidyadhar" <vidyadhar at lucidindia.net>
>Sent: Friday, January 23, 2004 12:42 PM
>Subject: Re: [vtkusers] get the point intensity?
>
>
>
>
>>Hi,
>>for the moment I use GetScalarComponentAsFloat(int x, int y, int z, int
>>component) with the position, what can I use with the Id?
>>
>>thanks
>>
>>
>>Vidyadhar wrote:
>>
>>
>>>Hi,
>>>Use the returned Id to access scalar/normals/etc. associated with the
>>>dataset.
>>>Vidyadhar
>>>
>>>
>
>
>
>
--
********************************************
Laurent Mundeleer
Université Libre de Bruxelles (ULB)
Service des Systèmes Logiques et Numériques (SLN) CP165/57
50, Av. F.Roosevelt
1050 Bruxelles
Belgium
tel : ++32.2.650.22.97
fax : ++32.2.650.22.98
e-mail : lmundele at ulb.ac.be
********************************************
More information about the vtkusers
mailing list