[vtkusers] Fwd: Volume Rendering with multiple-array data

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed Feb 23 14:17:17 EST 2005


Randall,

	Sorry I cannot reproduce any problem. You seems to be using VTK CVS, 
can you update to today ?
	Also if you are using an ATI card on linux, could you export :

export LIBGL_ALWAYS_INDIRECT=1

before running your program ? Or if you have mesa on your system can you do:

export LD_PRELOAD=/opt/Mesa/lib/libGL.so

before running your program

Thanks
Mathieu

Randall Hand wrote:
> Sorry, yeah that's a cut/paste mistake.  to prevent it again, I've
> attached my source file to this email.  i've made alot of
> modifications, namely 2 defines at the top to control Texture2D vs
> Raycast mapping, & Onscreen vs Offscreen mapping.  Everything I've
> done, i've been able to simply comment the "#define RAYCAST" line, and
> it works beautifully with Texture2d.
> 
> I tried it just now with blow.vtk, & with ironProt.vtk and both do
> similar things.  Sometimes they'll render initially, then crash as
> soon as I interact with it.  Other times they just crash immediately.
> 
> Thanks for the help :)
> 
> 
> On Wed, 23 Feb 2005 13:51:16 -0500, Mathieu Malaterre
> <mathieu.malaterre at kitware.com> wrote:
> 
>>Randall,
>>
>>        I tried reproducing your bug with blow.vtk (part of VTKData) with no
>>luck. If you were able to reproduce the bug with blow.vtk I could look
>>into it, or just send my your dataset.
>>
>>        BTW you script redeclare twice:
>>
>> >     vtkGaussianSplatter *filter = vtkGaussianSplatter::New();
>> >     filter->SetNullValue(0.0);
>> >     filter->SetInput(mask->GetOutput());
>> >     filter->Update();
>> >     printf("Filter ran\n");
>> >
>> >     vtkImageShiftScale *scaled = vtkImageShiftScale::New();
>> >     scaled->SetInput(filter->GetOutput());
>> >     scaled->SetScale(255.0);
>> >     scaled->SetOutputScalarTypeToUnsignedChar();
>> >     scaled->Update();
>> >     printf("Data Scaled ran\n");
>> >     printf("* Scaled data arrays:\n");
>> >     vtkPointData *dataptr = scaled->GetOutput()->GetPointData();
>> >     for(n=0; n< dataptr->GetNumberOfArrays(); n++) {
>> >         printf("*   [%i] \"%s\"\n", n, dataptr->GetArrayName(n));
>> >     }
>> >     scaled->GetOutput()->GetPointData()->GetArray(0)->GetRange(range,0);
>> >     printf("* Range: %f - %f\n", range[0], range[1]);
>>
>>        Is this a copy/paste mistake ?
>>
>>Thanks,
>>Mathieu
>>
>>
>>Randall Hand wrote:
>>
>>>Still looking for any help with this... I've gotten it to work witht
>>>he vtkVolumeTextureMapper2D just fine, but simply replacing that with
>>>the vtkVolumeRayCastMapper calls results in all kinds of weird
>>>behaviour.
>>>
>>>Sometimes it exits with a segfault/core dump, but no error.
>>>
>>>Sometimes it runs to completion, but the volume rendering doesn't work
>>>(I get the text & outline, but no data).
>>>
>>>Most commonly I get anywhere from 1 to 3 messages like this:
>>>ERROR: In /viz/home/rhand/src/ezViz/Utilities/VTK/Filtering/vtkExecutive.cxx,
>>>line 519
>>>vtkStreamingDemandDrivenPipeline (0x1d6038d0): Non-forwarded requests
>>>are not yet implemented.
>>>
>>>And sometimes I get garbage like this: (looks like multiple errors interlaced)
>>>ERROR: In /viz/home/rhand/src/ezViz/Utilities/VTK/FiltEEeRRrRRiOOnRRg::/
>>> vIItnnk  E//xvveiiczzu//thhioovmmeee.//crrxhhxaa,nn ddl//issnrrecc
>>>//5ee1zz9VV
>>>iivzzt//kUUStttiirlleiiattmiiieenssg//DVVeTTmKKa//nFFdiiDllrttieevrreiinnnPggi//pvvettlkkiEEnxxeee
>>>cc(uu0ttxii1vv0ee9..7cc1xxdxxb,,8  )ll:ii nnNeeo  n55-11f99o
>>>(truncated by me, you get the point)
>>>
>>>The messages seem to occur after the ->Render() call, and during the
>>>part where I write it to disk.  (with a vtkTIFFWriter).  Sometimes it
>>>segfaults right after the error messages, and sometimes it just hangs
>>>indefinately.  Once or twice it's even run to completion after the
>>>error messages, but the Volume Rendering never appears.  I'm using
>>>OffScreen rendering with MangledMesa.
>>>
>>>Please? Anyone?
>>>
>>>---------- Forwarded message ----------
>>>From: Randall Hand <randall.hand at gmail.com>
>>>Date: Wed, 16 Feb 2005 11:29:16 -0600
>>>Subject: Volume Rendering with multiple-array data
>>>To: vtkusers at vtk.org
>>>
>>>
>>>I have a VTK Dataset with with multiple data values per point.  Each
>>>data point in my rectilinear grid has both a scalar (fractional
>>>occupancy) and a vector (flow velocity).  I want to generate a volume
>>>rendering from this dataset of the scalar field, using the RayCast
>>>volume code.
>>>
>>>How do I get from the vtkDataSet that vtkDataSetReader outputs, to the
>>>vtkImageData that the volume rendering routines want?  Currently I'm
>>>using a GaussianSPlatter to convert to an imageData, & a
>>>vtkImageShiftScale to convert from the 0-1float to a 0-255unsigned
>>>char.
>>>
>>>Here's an exerpt from my code:
>>>
>>>***BEGIN***
>>>
>>>    // Load model
>>>    vtkDataSetReader *model = vtkDataSetReader::New();
>>>    model->SetFileName(filename);
>>>    model->Update();
>>>    printf("File loaded\n");
>>>    model->GetOutput()->GetPointData()->GetArray("Fraction")->GetRange(range,0);
>>>    printf("* Range: %f - %f\n", range[0], range[1]);
>>>
>>>    vtkMaskPoints *mask = vtkMaskPoints::New();
>>>    mask->SetInput(model->GetOutput());
>>>    mask->RandomModeOn();
>>>    mask->SetMaximumNumberOfPoints(10);
>>>    mask->Update();
>>>    printf("Data Masked\n");
>>>    mask->GetOutput()->GetPointData()->GetArray("Fraction")->GetRange(range,0);
>>>    printf("* Range: %f - %f\n", range[0], range[1]);
>>>
>>>    vtkGaussianSplatter *filter = vtkGaussianSplatter::New();
>>>    filter->SetNullValue(0.0);
>>>    filter->SetInput(mask->GetOutput());
>>>    filter->Update();
>>>    printf("Filter ran\n");
>>>
>>>    vtkImageShiftScale *scaled = vtkImageShiftScale::New();
>>>    scaled->SetInput(filter->GetOutput());
>>>    scaled->SetScale(255.0);
>>>    scaled->SetOutputScalarTypeToUnsignedChar();
>>>    scaled->Update();
>>>    printf("Data Scaled ran\n");
>>>    printf("* Scaled data arrays:\n");
>>>    vtkPointData *dataptr = scaled->GetOutput()->GetPointData();
>>>    for(n=0; n< dataptr->GetNumberOfArrays(); n++) {
>>>        printf("*   [%i] \"%s\"\n", n, dataptr->GetArrayName(n));
>>>    }
>>>    scaled->GetOutput()->GetPointData()->GetArray(0)->GetRange(range,0);
>>>    printf("* Range: %f - %f\n", range[0], range[1]);
>>>    vtkGaussianSplatter *filter = vtkGaussianSplatter::New();
>>>    filter->SetNullValue(0.0);
>>>    filter->SetInput(mask->GetOutput());
>>>    filter->Update();
>>>    printf("Filter ran\n");
>>>
>>>    vtkImageShiftScale *scaled = vtkImageShiftScale::New();
>>>    scaled->SetInput(filter->GetOutput());
>>>    scaled->SetScale(255.0);
>>>    scaled->SetOutputScalarTypeToUnsignedChar();
>>>    scaled->Update();
>>>    printf("Data Scaled ran\n");
>>>    printf("* Scaled data arrays:\n");
>>>    vtkPointData *dataptr = scaled->GetOutput()->GetPointData();
>>>    for(n=0; n< dataptr->GetNumberOfArrays(); n++) {
>>>        printf("*   [%i] \"%s\"\n", n, dataptr->GetArrayName(n));
>>>    }
>>>    scaled->GetOutput()->GetPointData()->GetArray(0)->GetRange(range,0);
>>>    printf("* Range: %f - %f\n", range[0], range[1]);
>>>
>>>    vtkVolumeRayCastCompositeFunction *compFunc =
>>>                vtkVolumeRayCastCompositeFunction::New();
>>>    compFunc->SetCompositeMethodToInterpolateFirst();
>>>
>>>    vtkPiecewiseFunction *xf_Opacity = vtkPiecewiseFunction::New();
>>>    xf_Opacity->AddPoint(0,0.0);
>>>    xf_Opacity->AddPoint(255,1.0);
>>>
>>>    vtkColorTransferFunction *xf_Color = vtkColorTransferFunction::New();
>>>    xf_Color->AddRGBPoint(0, 0, 0, 1);
>>>    xf_Color->AddRGBPoint(255, 0, 0, 1);
>>>
>>>    vtkVolumeProperty *volProp = vtkVolumeProperty::New();
>>>    volProp->SetColor(xf_Color);
>>>    volProp->SetScalarOpacity(xf_Opacity);
>>>    volProp->SetInterpolationTypeToLinear();
>>>
>>>    modelMapper = vtkVolumeRayCastMapper::New();
>>>    modelMapper->SetInput(scaled->GetOutput());
>>>    modelMapper->SetVolumeRayCastFunction(compFunc);
>>>//  modelMapper->Update();
>>>
>>>    printf("Mapper updated\n");
>>>    vtkVolume *volume = vtkVolume::New();
>>>    volume->SetMapper(modelMapper);
>>>    volume->SetProperty(volProp);
>>>***END***
>>>
>>>When I run this, tho, I get the following output:
>>>=============== BEGIN OUTPUT ==============
>>>Loading file test.vtk...
>>>File loaded
>>>* Range: 0.000000 - 1.000000
>>>Data Masked
>>>* Range: 0.000000 - 1.000000
>>>Filter ran
>>>Data Scaled ran
>>>* Scaled data arrays:
>>>*   [0] "(null)"
>>>* Range: 0.000000 - 253.000000
>>>Mapper updated
>>>ERROR: In /viz/home/rhand/src/ezViz/Utilities/VTK/Filtering/vtkExecutive.cxx,
>>>line 519
>>>vtkStreamingDemandDrivenPipeline (0x109843b8): Non-forwarded requests
>>>are not yet implemented.
>>>
>>>Segmentation fault (core dumped)
>>>================ END OUTPUT ============
>>>
>>>Any ideas?
>>>--
>>>Randall Hand
>>>http://www.yeraze.com
>>>
>>>
>>
>>
> 
> 




More information about the vtkusers mailing list