[vtkusers] vtkIsoVolume example?
Jérôme
jerome.velut at gmail.com
Thu Apr 21 02:52:11 EDT 2011
Hi,
you can try ReleaseDataFlagOn() on your filters/reader. It will free
the memory of the output ports.
HTH
Jerome
2011/4/21 Alexis Chan <alexisc at cs.unc.edu>:
> 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
>>
>>
>
>
>
> --
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list