[vtkusers] save mhd from QVTKWidget

Dženan Zukić dzenanz at gmail.com
Thu Mar 17 12:45:00 EDT 2011


You cannot save 3D image from QVTKWidget, because QVTKWidget is a 2D widget.
To save 3D image you have to access vtkVolume which you added to the scene
earlier. If however you have a polygonal scene which you want to voxelize,
take a look here: http://www.vtk.org/Wiki/VTK/Examples/Broken/VoxelModeller

2011/3/17 G G <greenlander1986 at gmail.com>

> I would like to save 3D image, but I do not know, where the problem can be.
> Discrepancy might be my problem, but I do not know, how to solve this
> problem...
> I am newbie with VTK...
>
>
> 2011/3/17 Dženan Zukić <dzenanz at gmail.com>
>
>> Are you trying to save 2D or 3D image? I believe your code is attempting
>> to save rendered framebufferm which is a 2D image. MetaImage is usually used
>> for 3D data, although it can save 2D data too. This 2D/3D discrepancy might
>> be your problem.
>>
>> HTH
>>
>> On Thu, Mar 17, 2011 at 16:42, G G <greenlander1986 at gmail.com> wrote:
>>
>>> Hi everyone,
>>> I have some problem. I would like to save *.mhd file from QVTKWidgetcomponent. I tried to seach on google, but any solution.
>>>
>>>         qVTK3->setAutomaticImageCacheEnabled(true);
>>>         vtkSmartPointer<vtkMetaImageWriter> writer =
>>> vtkSmartPointer<vtkMetaImageWriter>::New();
>>>         qVTK3->saveImageToCache();
>>>         writer->SetInput(qVTK3->cachedImage());
>>>         writer->SetFileName(fileName);
>>>         std::string  str = fileName + ".raw";
>>>         writer->SetRAWFileName(str.c_str());
>>>         writer->Write();
>>>
>>> qVTK3 is QVTKWidget.
>>>
>>> This code save empty files...
>>> I have to recomend, that I loaded *.mha or *.mhd files.
>>> I will be very happy for each help...
>>> Thanks a lot
>>>
>>> _______________________________________________
>>> 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/20110317/1fabde42/attachment.htm>


More information about the vtkusers mailing list