[vtkusers] Structured Points
Sepp^ Huber
sepp.huber21 at gmx.at
Mon Dec 2 14:34:10 EST 2002
Hi all,
I've got a problem which should be fairly easy but I haven't been able to
figure it out.
In principle I have a collection of records consisting of three coordinates
(X, Y, Z) and a value. What I actually want is to create a volume rendering
of this dataset.
What I have so far is the following:
I create a structure points object & a scalar array. Then I'd fill the
scalar array with my values and for this I'd need the index where to put each
value. The problem is that I haven't been able to figure out how to calculate the
correct index from my X,Y,Z values because it doesn't seem to follow the
structure a 3D array in C would have.
CData -> my structure where X,Y,Z & the Value is stored
vtkScalars *pScalars = vtkScalars::New();
pScalars->SetDataTypeToUnsignedShort();
m_pVolumeData = vtkStructuredPoints::New();
m_pVolumeData->SetDimensions( DimX, DimY, DimZ);
m_pVolumeData->SetOrigin( 0, 0, 0);
m_pVolumeData->SetSpacing( 1.0 / (DimX - 1.0), 1.0 / (DimY - 1.0), 1.0 /
(DimZ - 1.0) );
// fill
for( Iter = Data.begin(); Iter != Data.end(); Iter++ ) {
Iter->GetPos( X, Y, Z);
Val = Iter->GetVal();
// calculate an index from 3D coordinates like it would be done in C/C++
// for an array a[x][y][z]
Index = (X * DimY + Y) * DimZ + Z;
pScalars->InsertScalar( Index, Val);
}
m_pVolumeData->GetPointData()->SetScalars( pScalars ); // assign to
structured points
pScalars->Delete();
If anybody knows how to do this correctly or how to assign data which
consists of three coordinates + the value at these coordinates to a structured
points object then let me know!
I'd appreciate any help & if you could reply via mail please!
Thanks in advance!
Regards
Joe
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!
More information about the vtkusers
mailing list