[vtkusers] About vtkImageData
Wagner Sales
wsalles2003 at yahoo.com.br
Tue Jun 27 16:53:46 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Marium,
I was solved a problem on my class by using the following method:
double MyClass::computeScalarValue( vtkImageData *image, double *coords)
{
double tol2;
vtkCell *cell;
vtkPointData *pd;
int subId;
double pcoords[3], weights[8];
pd = image->GetPointData();
vtkPointData* outPD = vtkPointData::New();
outPD->InterpolateAllocate(pd, 1, 1);
tol2 = image->GetLength();
tol2 = tol2 ? tol2*tol2 / 1000.0 : 0.001;
cell = image->FindAndGetCell(coords,NULL,-1,tol2,subId,pcoords,weights);
if (cell)
{
outPD->InterpolatePoint(pd,0,cell->PointIds,weights);
return outPD->GetScalars()->GetTuple1(0);
} else {
return -1;
}
outPD->Delete();
}
This method are copied from vtkImageViewerWidget, and in my class
receives vtkImageData just because are a static method. Just take a
look on original code ( are more explained ). In above case, I need
the coordinates from the pixel to give this information.
May be that's no completely solve your problem, but can put you in the
right way.
Regards
Wagner
marium ahmed wrote:
> Dear all, I'm trying to manipulate vtkImageData to access its cell
> and get, for example, the pixels grey level in order to use them
> in making some filter. I was told that the function
> "GetScalarPointer" returns a pointer to the cells grey levels but
> upon trial, this doesn't seem true. So which function can I use to
> get the pixels grey level and location?
>
> thanks in advance, marium
>
> ----------------------------------------------------------------------
> How low will we go? Check out Yahoo! Messenger?s low PC-to-Phone
> call rates.
> <http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
>
>
>
> <http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
>
>
> ----------------------------------------------------------------------
>
>
>
> _______________________________________________ This is the private
> VTK discussion list. Please keep messages on-topic. Check the FAQ
> at: http://www.vtk.org/Wiki/VTK_FAQ Follow this link to
> subscribe/unsubscribe: http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> <http://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFEoZrYG0tpd3N7UOYRAqJVAJwJDDb9WgLX8IpPW2IF91JWFBSAOACgpwAV
jtuh3aBQ70UjacBH3qfYCMo=
=Qb3F
-----END PGP SIGNATURE-----
_______________________________________________________
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora!
http://br.mobile.yahoo.com/mailalertas/
More information about the vtkusers
mailing list