[vtkusers] SetDataSpacing does not work
samo
sandra.moritz at gmx.de
Tue Oct 10 11:15:04 EDT 2006
Hello together
first of all, thanks for all the tips. Unfortunately, none of them worked. I
just don't understand why the spacing is totally ignored.
Here is my code:
CString filename = fDlg.GetPathName();
m_MetaVolumeReader->GetOutput()->SetOrigin(0.0, 0.0, 0.0);
m_MetaVolumeReader->SetFileName(filename);
m_MetaVolumeReader->SetDataExtent(0,511,0,511,0,102);
m_MetaVolumeReader->SetDataByteOrderToLittleEndian();
m_volumeData = m_MetaVolumeReader->GetOutput();
ImageReslice* reslice = vtkImageReslice::New();
reslice->SetInput(m_MetaVolumeReader->GetOutput());
reslice->InterpolateOn();
reslice->SetOutputSpacing(1.0, 1.0, 2.0);
.........marching cubes, polydata, renderer.....
David Gobbi wrote:
>
> 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
>>>
>>>
>>>
>>
>>
>
> _______________________________________________
> 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
>
>
--
View this message in context: http://www.nabble.com/SetDataSpacing-does-not-work-tf2393944.html#a6738600
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list