[vtkusers] Imageimport

xiong fei xfpku at yahoo.com.sg
Tue Feb 20 12:22:29 EST 2001


Dear vtkusers

    I met a problem in using vtkImageImport. I have a
two dimensional dataset(time and price), and want to
add it into an array as the index and value
separatedly(exp. dataArray). Then I use vtkImageImport
to retreive the data and get the result as an input of
vtkVolumeRayCastMapper. But what make me confused is
that there is no picture shown. So I put my source
code below and hope that someone can help me.

Best Regards
Peter


//Xextent equals to the length of dataAarray, and
Yextent, Zextent equal to 1
//The value of data in the array is simple number,
such as 1, 2, 3, 4 ... 30

vtkImageImport *importer = vtkImageImport::New();
	importer->SetDataExtent(0, Xextent-1, 0, Yextent-1,
0, Zextent-1);
	importer->SetDataScalarTypeToUnsignedChar();
	importer->SetImportVoidPointer(dataArray);

vtkPiecewiseFunction *oTFun =
vtkPiecewiseFunction::New();
 oTFun->AddSegment(1, 0.0, 30, 1.0);

vtkColorTransferFunction *cTFun =
vtkColorTransferFunction::New();
cTFun->AddRGBSegment(1,1,0,0,30,0,1,0);

vtkVolumeProperty *volumeProperty =
vtkVolumeProperty::New();
    volumeProperty->SetColor(cTFun);
    volumeProperty->SetScalarOpacity(oTFun);
    volumeProperty->SetInterpolationTypeToLinear();
volumeProperty->ShadeOn();

vtkVolumeRayCastCompositeFunction *compositeFunction =

    vtkVolumeRayCastCompositeFunction::New();

vtkVolumeRayCastMapper *volumeMapper =
vtkVolumeRayCastMapper::New();
volumeMapper->SetInput(importer->GetOutput());
   
volumeMapper->SetVolumeRayCastFunction(compositeFunction);

....

__________________________________________________
Do You Yahoo!?
Yahoo! Mail – Free email you can access from anywhere!
http://mail.yahoo.com.sg/




More information about the vtkusers mailing list