[vtkusers] problem in getting scalar values

Laurent Mundeleer lmundele at ulb.ac.be
Tue Feb 3 03:33:17 EST 2004


Hi all,

I've 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, and 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
********************************************






More information about the vtkusers mailing list