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 <alex...@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
_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to