[vtkusers] vtkIsoVolume example?

Alexis Chan alexisc at cs.unc.edu
Thu Apr 21 02:06:40 EDT 2011


Hi

I found out that there was nothing wrong with the code snippet. I simply ran
out of memory, so I could not do online rendering.  I saved the vtkIsoVolume
into an Unstructured Grid file and reopened it for offline rendering. Let me
know if there is a more efficient way of doing this.

Thanks!

vtkXMLUnstructuredGridReader* reader = vtkXMLUnstructuredGridReader::New();
reader->SetFileName("C://MyFile.vtu");

vtkIsoVolume* myIsoVolume = vtkIsoVolume::New();
myIsoVolume ->SetInput((vtkDataSet*)reader->GetOutput());
myIsoVolume ->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,"Pressure");
myIsoVolume ->ThresholdBetween(-100,100);
myIsoVolume ->Update()

    vtkXMLUnstructuredGridWriter* writer2 =
vtkXMLUnstructuredGridWriter::New();
    vtkUnstructuredGrid* unstructGrid =
(vtkUnstructuredGrid*)myIsoVolume ->GetOutputDataObject(0);

    writer2->SetInput((vtkDataSet*)unstructGrid);
    writer2->SetFileName(volwriter);
    writer2->Write();

Next run of application:

           vtkXMLUnstructuredGridReader* reader =
vtkXMLUnstructuredGridReader::New();
    reader->SetFileName(volreader);
    vtkGeometryFilter* geomFilter = vtkGeometryFilter::New();
    geomFilter->SetInput(reader->GetOutput());

geomFilter->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,"Pressure");


    geomFilter->Update();
    vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
    mapper->SetInput(geomFilter->GetOutput());
         // Render code

On Wed, Apr 20, 2011 at 4:41 AM, Alexis Chan <alexisc at cs.unc.edu> wrote:

> Hi
>
> Is there a vtkIsoVolume example that I can refer to? When I open a vtu
> file in ParaView and apply the "Iso Volume" filter to it, I am able to see
> the Iso Volume.  I tried to replicate that in my VTK application but I ran
> into "Unable to allocate memory" error.
> Here's the code snippet ( I verified using the debugger that ParaView uses
> the same values for the SetInputArrayToProcess):
>
> vtkXMLUnstructuredGridReader* reader = vtkXMLUnstructuredGridReader::New();
> reader->SetFileName("C://MyFile.vtu");
>
> vtkIsoVolume* myIsoVolume = vtkIsoVolume::New();
> myIsoVolume ->SetInput((vtkDataSet*)reader->GetOutput());
>
> myIsoVolume ->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,"Pressure");
> myIsoVolume ->ThresholdBetween(-100,100);
> myIsoVolume ->Update();
>
> --
> Regards,
> Alexis
>
>  <http://alexisylchan.wordpress.com/>
>



-- 
Regards,
Alexis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110421/53ee1de1/attachment.htm>


More information about the vtkusers mailing list