[Paraview] Blurred volume rendering

Thomas Oliveira thomas.oliveira at gmail.com
Mon Dec 7 20:58:14 EST 2015


Dear Aashish,

I tried to build ParaView from master, but I get an error that is the
subject of another discussion on the list ("Error while building,
H5_SIZEOF_SIZE_T is undefined"). Could I try to apply the patch on some
version available from http://www.paraview.org/download/, maybe a nightly
build?

Best wishes,

Thomas

On Thu, Dec 3, 2015 at 5:31 AM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:

> Dear Thomas,
>
> If it is possible for you to build ParaView from master (as of today) with
> OpenGL2 backend, then apply this patch (attached) and see if this works for
> you. This might work on older version or OpenGL1 backend but I haven't
> tested it, so use at your risk. Once applied and build, you can find for
> "Interpolation" option in advance search box. It will show "Nearest,
> Linear, and Cubic".
>
> Thanks,
>
>
> On Wed, Dec 2, 2015 at 11:59 AM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
>> Hi Thomas,
>>
>> Please find the attached image which I rendered using VTK code and in
>> there I used nearest interpolation. Please let me know if this is what you
>> expect. I will see if we can push a change to ParaView to expose this
>> feature.
>>
>> Thanks,
>>
>>
>> int TestGPURayCastVolumeUpdate(int argc, char *argv[])
>>
>> {
>>
>>   cout << "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)" << endl;
>>
>>
>>   double scalarRange[2];
>>
>>
>>   vtkNew<vtkActor> outlineActor;
>>
>>   vtkNew<vtkPolyDataMapper> outlineMapper;
>>
>>   vtkNew<vtkGPUVolumeRayCastMapper> volumeMapper;
>>
>>
>>   vtkNew<vtkImageReader2> reader;
>>
>>   reader->SetFilePrefix("/home/chaudhary/tools/paraview_main/Image/Berea.raw");
>>
>>   reader->SetFilePattern("%s");
>>
>>   reader->SetFileDimensionality(3);
>>
>>   reader->SetDataByteOrderToLittleEndian();
>>
>>   reader->SetDataScalarTypeToUnsignedChar();
>>
>>   reader->SetDataExtent(0, 399, 0, 399, 0, 399);
>>
>>   reader->SetFileLowerLeft(1);
>>
>>   reader->SetDataOrigin(0, 0, 0);
>>
>>   reader->SetDataSpacing(1.0, 1.0, 1.0);
>>
>>   reader->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "ImageFile");
>>
>>   reader->Update();
>>
>>
>>   volumeMapper->SetInputConnection(reader->GetOutputPort());
>>
>>
>>   // Add outline filter
>>
>>   vtkNew<vtkOutlineFilter> outlineFilter;
>>
>>   outlineFilter->SetInputConnection(reader->GetOutputPort());
>>
>>   outlineMapper->SetInputConnection(outlineFilter->GetOutputPort());
>>
>>   outlineActor->SetMapper(outlineMapper.GetPointer());
>>
>>
>>   volumeMapper->GetInput()->GetScalarRange(scalarRange);
>>
>>   volumeMapper->SetAutoAdjustSampleDistances(0);
>>
>>   volumeMapper->SetBlendModeToComposite();
>>
>>
>>   vtkNew<vtkRenderWindow> renWin;
>>
>>   renWin->SetMultiSamples(0);
>>
>>   renWin->SetSize(400, 400);
>>
>>
>>   vtkNew<vtkRenderWindowInteractor> iren;
>>
>>   iren->SetRenderWindow(renWin.GetPointer());
>>
>>   vtkNew<vtkInteractorStyleTrackballCamera> style;
>>
>>   iren->SetInteractorStyle(style.GetPointer());
>>
>>
>>   renWin->Render(); // make sure we have an OpenGL context.
>>
>>
>>   vtkNew<vtkRenderer> ren;
>>
>>   ren->SetBackground(0.2, 0.2, 0.5);
>>
>>   renWin->AddRenderer(ren.GetPointer());
>>
>>
>>   vtkNew<vtkPiecewiseFunction> scalarOpacity;
>>
>>   scalarOpacity->AddPoint(0.0, 0.0);
>>
>>   scalarOpacity->AddPoint(0.4, 0.0);
>>
>>   scalarOpacity->AddPoint(0.4, 0.1);
>>
>>   scalarOpacity->AddPoint(1.0, 0.2);
>>
>>
>>   vtkNew<vtkVolumeProperty> volumeProperty;
>>
>> *  volumeProperty->SetInterpolationType(VTK_NEAREST_INTERPOLATION);*
>>
>>   volumeProperty->SetScalarOpacity(scalarOpacity.GetPointer());
>>
>>   volumeProperty->ShadeOn();
>>
>>
>>   vtkNew<vtkColorTransferFunction> colorTransferFunction;
>>
>>   colorTransferFunction->RemoveAllPoints();
>>
>>   colorTransferFunction->AddRGBPoint(scalarRange[0], 0.6, 0.4, 0.4);
>>
>>   colorTransferFunction->AddRGBPoint(scalarRange[1], 1.0, 1.0, 0.4);
>>
>>   volumeProperty->SetColor(colorTransferFunction.GetPointer());
>>
>>
>>   vtkNew<vtkVolume> volume;
>>
>>   volume->SetMapper(volumeMapper.GetPointer());
>>
>>   volume->SetProperty(volumeProperty.GetPointer());
>>
>>
>>   /// Add sphere in the center of volume
>>
>>   int dims[3];
>>
>>   double spacing[3], center[3], origin[3];
>>
>>   reader->Update();
>>
>>   vtkSmartPointer<vtkImageData> im = reader->GetOutput();
>>
>>   im->GetDimensions(dims);
>>
>>   im->GetOrigin(origin);
>>
>>   im->GetSpacing(spacing);
>>
>>
>>   center[0] = origin[0] + spacing[0]*dims[0]/2.0;
>>
>>   center[1] = origin[1] + spacing[1]*dims[1]/2.0;
>>
>>   center[2] = origin[2] + spacing[2]*dims[2]/2.0;
>>
>>
>>   ren->AddVolume(volume.GetPointer());
>>
>>   ren->AddActor(outlineActor.GetPointer());
>>
>>   ren->ResetCamera();
>>
>>   renWin->Render();
>>
>>
>>   iren->Initialize();
>>
>>   iren->Start();
>>
>> }
>>
>>
>> On Wed, Dec 2, 2015 at 10:13 AM, Aashish Chaudhary <
>> aashish.chaudhary at kitware.com> wrote:
>>
>>> Thomas,
>>>
>>> I am looking at your data in VTK. I will report back. In ParaView, you
>>> cannot choose linear or nearest as of now. We have a plan to expose all of
>>> the volume property parameters in ParaView (hopefully soon).
>>>
>>> Thanks,
>>>
>>>
>>> On Mon, Nov 30, 2015 at 3:06 PM, Thomas Oliveira <
>>> thomas.oliveira at gmail.com> wrote:
>>>
>>>> Dear Aashish,
>>>>
>>>> Can I choose the interpolation (linear vs nearest) or is it hard-coded
>>>> on the call of VTK from Paraview?
>>>>
>>>> A dataset can be downloaded from
>>>> http://www3.imperial.ac.uk/pls/portallive/docs/1/33505696.ZIP .
>>>> Please extract the Berea.raw file from the zip.
>>>> I loaded it using:
>>>> """
>>>> Raw (binary) Files
>>>> Data Scalar Type: unsigned char
>>>> Data Byte Order: Little Endian
>>>> Data Extent: 0-399, 0-399, 0-399
>>>> """
>>>>
>>>> Thank you for your attention,
>>>>
>>>> Thomas Oliveira
>>>>
>>>>
>>>> On Mon, Nov 30, 2015 at 4:31 PM, Aashish Chaudhary <
>>>> aashish.chaudhary at kitware.com> wrote:
>>>>
>>>>> Thomas,
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Nov 30, 2015 at 10:34 AM, Thomas Oliveira <
>>>>> thomas.oliveira at gmail.com> wrote:
>>>>>
>>>>>> Dear Aashish,
>>>>>>
>>>>>>
>>>>>> I'm using Paraview 4.4.0 64-bit , OpenGL Version 4.5.0 NVIDIA 352.55,
>>>>>> OpenGL Renderer Quadro K600/PCIe/SSE2.
>>>>>>
>>>>>> Tweaking the transfer function improved the result, but the corners
>>>>>> are rendererd rounded, whereas in the original file I have only cubic
>>>>>> voxels.
>>>>>>
>>>>>
>>>>> I am wondering if that would be because of the interpolation (linear
>>>>> vs nearest) since linear will smooth out the edges just a bit. Is there a
>>>>> sample dataset you can send my way?
>>>>>
>>>>>
>>>>>> I though that unsetting "Properties > Scalar Coloring > Interpolate
>>>>>> Scalars Before Mapping" would improve the image, but I saw no change.
>>>>>>
>>>>>> You suggested to enable shading, but I couldn't find it. Where is it?
>>>>>>
>>>>>
>>>>> Its on the same panel (left side), scroll to the bottom or search for
>>>>> "shade" you should be see it.
>>>>>
>>>>> - aashish
>>>>>
>>>>>>
>>>>>>
>>>>>> Thank you for your help,
>>>>>>
>>>>>> Thomas Oliveira
>>>>>>
>>>>>>
>>>>>> On Mon, Nov 30, 2015 at 3:07 PM, Aashish Chaudhary <
>>>>>> aashish.chaudhary at kitware.com> wrote:
>>>>>>
>>>>>>> Hi Thomas,
>>>>>>>
>>>>>>> On Mon, Nov 30, 2015 at 8:54 AM, Thomas Oliveira <
>>>>>>> thomas.oliveira at gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> The Sample.png file attached is an image of a pore medium. Each
>>>>>>>> voxel in the image is a cube that is either solid or void.
>>>>>>>>
>>>>>>>> The Zoom.png file attached is a zoom of it, where it can be seen
>>>>>>>> that the curved interior solid walls are approximated by a staircase
>>>>>>>> discretization.
>>>>>>>>
>>>>>>>> How can I render this staircase geometry more clearly?
>>>>>>>>
>>>>>>>
>>>>>>> Did you try to tweak the transfer function? Also, you can enable
>>>>>>> shading to have a look of a solid surface.
>>>>>>>
>>>>>>>
>>>>>>>> I have tried tweaking many properties on ParaView but I still get
>>>>>>>> it blurred.
>>>>>>>>
>>>>>>>
>>>>>>> Just to be sure, what version of ParaView you are using and what
>>>>>>> OpenGL backend?
>>>>>>>
>>>>>>>>
>>>>>>>> Thank you for your help,
>>>>>>>>
>>>>>>>> Thomas Oliveira
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Powered by www.kitware.com
>>>>>>>>
>>>>>>>> Visit other Kitware open-source projects at
>>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>>
>>>>>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>>>>>> http://paraview.org/Wiki/ParaView
>>>>>>>>
>>>>>>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>>>>>>
>>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>>> http://public.kitware.com/mailman/listinfo/paraview
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>>>>>       *
>>>>>>> *| http://www.kitware.com/company/team/chaudhary.html
>>>>>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>>
>>>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>>>     *
>>>>> *| http://www.kitware.com/company/team/chaudhary.html
>>>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>>>   *
>>> *| http://www.kitware.com/company/team/chaudhary.html
>>> <http://www.kitware.com/company/team/chaudhary.html>*
>>>
>>
>>
>>
>> --
>>
>>
>>
>> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.
>> *
>> *| http://www.kitware.com/company/team/chaudhary.html
>> <http://www.kitware.com/company/team/chaudhary.html>*
>>
>
>
>
> --
>
>
>
> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
> *| http://www.kitware.com/company/team/chaudhary.html
> <http://www.kitware.com/company/team/chaudhary.html>*
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151208/bd0c61ec/attachment.html>


More information about the ParaView mailing list