[vtkusers] SetDataSpacing does not work

David Gobbi dgobbi at atamai.com
Fri Oct 6 10:50:52 EDT 2006


Hi Samo,

If you want to enlarge the image, you can do one of two things:

display the image with vtkImageActor, and use these camera methods:
camera->ParallelProjectionOn();
camera->SetParallelScale(scale);

- or - if you want to use vtkImageMapper (or vtkImageViewer),

change the spacing with vtkImageReslice:
reslice->InterpolationOn();
reslice->SetOutputSpacing(newpacing, newspacing, newspacing);

Using vtkImageReslice will resample the image.


The vtkImageMapper and vtkImageViewer completely ignore the
spacing, which is why you must resample the image before sending
it to them.


 - David


samo wrote:
> Well, I tried now vtkImageChangeInformation, and the
> m_MetaVolumeReader->GetOutput()->SetSpacing........
>
> but both did not work. 
>
> I try to change the spacing as the picture on the screen is too small and I
> thought, the easieast way might just be to change the data spacing. But
> maybe I should try to transform the volume. I have no idea, as I am totally
> new to vtk and do not know what possibilities I have.
>
> Thank you very much for any further help.
>
>
>
>
>
> John Biddiscombe wrote:
>   
>> But you should really use vtkImageChangeInformartion to preserve the 
>> change after filter updates.
>>
>> JB
>>
>>     
>>> samo wrote:
>>>       
>>>> Hello there
>>>>
>>>> I try to manipulate the data spacing from the data I get with
>>>> vtkMetaImageReader. The problem is, that after a pipeline update, the
>>>> spacing is set back to its original values. I don't understand why this
>>>> happens. Why is vtk just ignoring the SetDataSpacing?
>>>>
>>>> This is my code:
>>>>
>>>> vtkMetaImageReader *in_Reader = vtkMetaImageReader::New();
>>>> in_Reader->SetFileName( "MyFile.mhd" );   
>>>> in_Reader->Update();
>>>> in_Reader->SetDataSpacing(1.0,1.0,5.0);  //at this point, the spacing is
>>>> correct
>>>>         
>>> Try changing that to:
>>>
>>> in_Reader->GetOutput()->SetSpacing(1.,1.,5.);
>>>
>>> HTH
>>> Mathieu
>>> Ps: why would you want to change the spacing when it is read from a 
>>> file with a header ?
>>> _______________________________________________
>>> This is the private VTK discussion list. Please keep messages 
>>> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>       
>> -- 
>> John Biddiscombe,                            email:biddisco @ cscs.ch
>> http://www.cscs.ch/about/BJohn.php
>> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
>> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82
>>
>>
>> _______________________________________________
>> This is the private VTK discussion list. 
>> Please keep messages on-topic. Check the 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