[vtkusers] Need to save vtkVolume as an 3D image

Sahan Ranasinghe sahancr at gmail.com
Tue Sep 3 14:25:25 EDT 2013


Dear Dean,

This is the related part of my code. dataset is the read image series. you
mean I nead to write dataset as image series. Am i right?

vtkImageContinuousErode3D *dilate=vtkImageContinuousErode3D::New();
dilate->SetInput(dataset);
dilate->SetKernelSize(3,3,1);


vtkRenderer *renderer = vtkRenderer::New();

vtkVolumeRayCastMIPFunction *mip=vtkVolumeRayCastMIPFunction::New();
 vtkFixedPointVolumeRayCastMapper
*mapper=vtkFixedPointVolumeRayCastMapper::New();
mapper->SetInput(dilate->GetOutput());
mapper->SetSampleDistance(0.5);
mapper->Update();

vtkPiecewiseFunction *opacity=vtkPiecewiseFunction::New();
opacity->AddPoint(0,0.0);
opacity->AddPoint(1,1.0);

vtkVolumeProperty *property=vtkVolumeProperty::New();
property->IndependentComponentsOff();
property->SetScalarOpacity(opacity);

vtkVolume *volume=vtkVolume::New();
volume->SetMapper(mapper);
volume->SetProperty(property);
volume->Update();

Thank you for your help.

Regards,
Sahan


On Tue, Sep 3, 2013 at 11:48 PM, Dean Inglis <inglis.dl at gmail.com> wrote:

> vtkVolume inherits from vtkProp3D: an object that is rendered.
> It is not a data container (eg., vtkDataObject) and is therefore not
> something you can write to disk.
> As you stated, you already have your 3D image (data) in .raw file format.
> You could save it in another format (one single file or multiple files) if
> needed:
>
> vtkNew<vtkSome_Kind_Of_Image_Writer> writer;
> writer->SetInput( my_Raw_Image_Data_Reader->GetOutput() );
> writer->SetFileName( a_name );
> writer->Write();
>
> regards
> Dean
>
>
> On Tue, Sep 3, 2013 at 1:30 PM, Sahan Ranasinghe <sahancr at gmail.com>wrote:
>
>> I used VHP dataset (.raw) format images. first read all images and then
>> use VolumeRayCastMapper, VolumeProperty and generate a vtkVolume object. It
>> is visualized as i expected. Now I need to save this vtkVolume object as a
>> 3D image.
>>
>> Thanks,
>>
>> Regards,
>> Sahan
>>
>>
>> On Tue, Sep 3, 2013 at 9:56 PM, Jude Pereira <jpereira at advsolinc.com>wrote:
>>
>>>  Do you mean like a rendering of a 3D object in png? Or output as an
>>> obj solid? Or something else?****
>>>
>>> ** **
>>>
>>> Jude****
>>>
>>> ** **
>>>
>>> *From:* vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] *On
>>> Behalf Of *Sahan Ranasinghe
>>> *Sent:* Tuesday, September 03, 2013 11:51 AM
>>> *To:* vtkusers at vtk.org
>>> *Subject:* [vtkusers] Need to save vtkVolume as an 3D image****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> Hi,****
>>>
>>> ** **
>>>
>>> I need to save a vtkvolume object as a 3D image. Can you please give me
>>> any suggestion?****
>>>
>>> ** **
>>>
>>> Thank you.****
>>>
>>> ** **
>>>
>>> Regards,****
>>>
>>> Sahan****
>>>
>>> ** **
>>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130903/e33a6982/attachment.htm>


More information about the vtkusers mailing list