[vtkusers] get the point intensity?

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed Feb 4 09:50:49 EST 2004


Laurent,

	Your current extent is:

Current extent= (0, 668, 0, 658, 0, 0)
This is 2D image no z dimension.

But you are trying to access another slice just as a volume. Don't try 
accessing anything along the z direction, z should = 0.

Mathieu

Laurent Mundeleer wrote:
> 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
> 






More information about the vtkusers mailing list