[Insight-users] How to smooth the segmented surface

Xiaopeng Yang yxp233 at postech.ac.kr
Thu Mar 22 10:19:08 EDT 2012


I used linear interpolation in my code. Please have a look at my code:

 

       typedef itk::IdentityTransform< double, 3 > 

              TransformType; 

 

       typedef itk::LinearInterpolateImageFunction< OutputImageType, double > 

              InterpolatorType; 

 

       typedef itk::ResampleImageFilter< OutputImageType, OutputImageType > 

              ResampleFilterType; 

 

       InterpolatorType::Pointer interpolator = InterpolatorType::New(); 

 

       TransformType::Pointer transform = TransformType::New(); 

       transform->SetIdentity(); 

 

       OutputImageType::SizeType inputSize = filter2->GetOutput()->GetLargestPossibleRegion().GetSize();//filter2 is the segmented binary image

    

       OutputImageType::SpacingType inputSpacing = filter2->GetOutput()->GetSpacing();

 

       OutputImageType::SpacingType outputSpacing;

       outputSpacing[0] = inputSpacing[0];

       outputSpacing[1] = inputSpacing[1];

       outputSpacing[2] = 0.7;

 

       OutputImageType::SizeType outputSize; 

       typedef OutputImageType::SizeType::SizeValueType SizeValueType; 

       outputSize[0] = static_cast<SizeValueType>(inputSize[0] * inputSpacing[0] / outputSpacing[0] + .5); 

       outputSize[1] = static_cast<SizeValueType>(inputSize[1] * inputSpacing[1] / outputSpacing[1] + .5); 

       outputSize[2] = static_cast<SizeValueType>(inputSize[2] * inputSpacing[2] / outputSpacing[2] + .5); 

 

       ResampleFilterType::Pointer resampler = ResampleFilterType::New(); 

       resampler->SetInput( filter2->GetOutput() ); 

       resampler->SetTransform( transform ); 

       resampler->SetInterpolator( interpolator ); 

       resampler->SetOutputOrigin ( filter2->GetOutput()->GetOrigin()); 

       resampler->SetOutputSpacing ( outputSpacing ); 

       resampler->SetOutputDirection ( filter2->GetOutput()->GetDirection()); 

       resampler->SetSize ( outputSize ); 

       resampler->UpdateLargestPossibleRegion();

       //resampler->Update ();

   

       ExportFilterType2::Pointer itkExporter4 = ExportFilterType2::New();  

       itkExporter4->SetInput( resampler->GetOutput() );

       itkExporter4->Update();

 

       vtkImageImport* vtkImporter4 = vtkImageImport::New();  

       ConnectPipelines(itkExporter4, vtkImporter4);

 

       vtkContourFilter *iso = vtkContourFilter::New();

       iso->SetInput(vtkImporter4->GetOutput());

       iso->ComputeScalarsOn();

       iso->SetValue(0,128.1);

 

       vtkPolyDataMapper *isoMapper = vtkPolyDataMapper::New();

       isoMapper->SetInput(iso->GetOutput());

       isoMapper->ScalarVisibilityOff();

 

       iso->Delete();

 

       vtkActor *isoActor1 = vtkActor::New();

       isoActor1->SetMapper(isoMapper);

       isoActor1->GetProperty()->SetColor(1.0, 0.49, 0.25);

       

       isoMapper->Delete();

       

       ren_L->AddActor(isoActor1);

       

From: Dženan Zukić [mailto:dzenanz at gmail.com] 
Sent: Thursday, March 22, 2012 6:48 PM
To: Xiaopeng Yang
Cc: Kent Ogden; insight-users at itk.org
Subject: Re: [Insight-users] How to smooth the segmented surface

 

For the resampling you have to make sure to use either linear, cubic, or some more advanced interpolation scheme, not the nearest neighbor which is the default I think.

2012/3/22 Xiaopeng Yang <yxp233 at postech.ac.kr>

I resampled the segmented mask images. But when I apply vtkcontourfilter to generate a 3D surface, only iso-surfaces of the original slices of the mask images are generated, not including the resampled slices. Thus the results look the same as before. Still stairs appear.

 

Thanks,

Xiaopeng 

From: Dženan Zukić [mailto:dzenanz at gmail.com] 
Sent: Wednesday, March 21, 2012 7:07 PM
To: Xiaopeng Yang
Cc: Kent Ogden; insight-users at itk.org


Subject: Re: [Insight-users] How to smooth the segmented surface

 

You can resample <http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/ResampleImageFilter>  the image, or use linear interpolator <http://www.itk.org/Wiki/ITK/Examples/ImageProcessing/LinearInterpolateImageFunction> .

On Tue, Mar 20, 2012 at 14:07, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:

Hi Kent,

 

Do you know any interpolate class in ITK which can generate more slices? For volumetry, I guess I can use the original data.

 

Thanks,

Xiaopeng

 

From: Kent Ogden [mailto:ogdenk at upstate.edu] 
Sent: Tuesday, March 20, 2012 9:50 PM
To: insight-users at itk.org; Xiaopeng Yang


Subject: Re: [Insight-users] How to smooth the segmented surface

 

Xiaopeng, 

 

This is a fundamental limitation of your data that can only truly be solved by reconstructing thinner slices at the time of the scan.  You could interpolate between images to generate more slices, which would result in a smoother looking rendering.  If you are trying to make quantitative measurements (e.g. volume) you must be careful about these kinds of manipulations though. 

 

Kent 

 



>>> "Xiaopeng Yang" <yxp233 at postech.ac.kr> 3/19/2012 10:17 PM >>>

Dear Users, 

  

I have tried to segment the liver from 5 mm CT slices. When I tried to visualize the segmented liver in 3D, I found that the surface of the 3D liver was discrete, just like stairs. I guess that is because of the 5 mm interval between CT slices. Do you guys have any good idea how to make the 3D surface of the liver look continuous and smooth? 

  

Thanks, 

Xiaopeng 

 

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120322/928da3fe/attachment.htm>


More information about the Insight-users mailing list