[vtkusers] correction of spacing
Dominik Szczerba
dominik at itis.ethz.ch
Mon Nov 24 13:58:08 EST 2008
Haha! - see my recent posts.
Try updating the pipeline with the correct spacing.
Dominik
Bartosz Wiklak wrote:
> Hello,
>
> I'm using GDCM ( vtkGDCMImageReader ) to read some MR data.
> I switched SetComputeZSpacing on, set SetZSpacingTolerance to 1e-2
> and used IPPSorter.
> This is my code:
>
> vtkGDCMImageReader *reader = vtkGDCMImageReader::New();
>
>
>
> std::vector<std::string> filenames;
>
>
>
> gdcm::Directory d;
>
>
>
> d.Load( "/home/basiek/Dokumenty/dcms/testGLOWA/1", false );
>
>
>
> filenames = d.GetFilenames();
>
> gdcm::IPPSorter s;
>
> s.SetComputeZSpacing( true );
>
> s.SetZSpacingTolerance( 1e-2 );
>
> bool b = s.Sort( filenames );
>
> if( !b )
>
> {
>
> std::cerr << "Failed to sort:" << "s" << std::endl;
>
> return 1;
>
> }
>
>
>
> std::cout << "Sorting succeeded:" << s.GetZSpacing() << std::endl;
>
> //s.Print( std::cout );
>
>
>
> const std::vector<std::string> & sorted = s.GetFilenames();
>
>
>
> vtkStringArray *files = vtkStringArray::New();
>
> std::vector< std::string >::const_iterator it = sorted.begin();
>
> for( ; it != sorted.end(); ++it)
>
> {
>
> const std::string &f = *it;
>
> files->InsertNextValue( f.c_str() );
>
> }
>
> reader->SetFileNames( files );
>
> reader->Update();
>
> I'm getting zspacing 1.5 whitch is ok, but in the
> reader->GetOutput()->GetSpacing(spacing) I'm getiing spacing[2]==1.0 !
>
> What am I doing wrong?
> I tried to set pixelspacing manually but after
> reader->GetOutput()->UpdateInformation() I'm with old, wrong value
> again.
>
> When I make reslice in coronal I have eyes shaped like ellipses. I
> tired to set pixelspacing for vtkImageReslice:
> reslice->SetOutputSpacing( spacing[0], spacing[1], 1.5 );
>
> but this also makes no difference regardless
> reslice->GetOutput()->UpdateInformation().
>
> Can someone point me in the right direction?
> _______________________________________________
> 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
>
--
Dominik Szczerba, PhD
Computational Physics Group
IT'IS Foundation
http://www.itis.ethz.ch
More information about the vtkusers
mailing list