[vtkusers] Volume rendering
Sepp^ Huber
sepp.huber21 at gmx.at
Fri Feb 28 11:57:04 EST 2003
Hi all,
I've got the following problem that I'd like to create a volume rendering
for some simple data that I have at my hands. In principle I do have a bunch of
indexed cells/voxels and a corresponding value from radiation measurements.
Now I'd like to create a volume rendering of this data.
In principle I've set everything up including the ray casting functions and
so on. The crucial point is how to provide the data:
vtkVolumeRayCastMapper* pVolumeMapper = vtkVolumeRayCastMapper::New();
pVolumeMapper->SetInput( m_pData );
In this approach m_pData is a vtkStructuredPoints object which is filled
with a bunch of scalars (my radiation values). The problem is that I don't
really know how to set up the scalars in the correct order.
I do it the following way but this works only if the dimensions of X & Y & Z
are the same.
for( Iter = Data.begin(); Iter != Data.end(); Iter++ ) {
Iter->GetPos( X, Y, Z);
Val = Iter->GetVal();
Index = X + Y * DimY * DimZ + Z * DimZ; // calculate an index
from 3D coordinates
pScalars->InsertScalar( Index, Val);
if( Val < m_MinVal )
m_MinVal = Val;
if( Val > m_MaxVal )
m_MaxVal = Val;
}
m_pData->GetPointData()->SetScalars( pScalars ); // connect to
test data
}
If the dimensions are different then the whole picture looks scrambled.
Probably the calculation of the index from the voxel coordinates is wrong. If
somebody could give me a hint or point out a different way of doing it or any
other solution I'd be REALLY REALLY REALLY grateful!!!!
Thanks very much
Sepp
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!
More information about the vtkusers
mailing list