[Insight-users] LaplacianSegmentationLevelSetImageFilter and 3Dimage

Iván Macía imacia at vicomtech.es
Tue Dec 5 07:22:49 EST 2006


Hi Maria,

Consider the 2D case

const     unsigned int Dimension = 2;
typedef   short PixelType;
typedef itk::Image< PixelType, Dimension >  ImageType;
typedef itk::BinaryThresholdImageFilter< ImageType, ImageType >
ThresholdFilterType;

This defines ThresholdFilterType a type for a binary threshold filter that
takes as input a 2D image of shorts and whose output is a 2D image of
shorts.

Now consider the 3D case

const     unsigned int Dimension = 3;
typedef   short PixelType;
typedef itk::Image< PixelType, Dimension >  ImageType;
typedef itk::BinaryThresholdImageFilter< ImageType, ImageType >
ThresholdFilterType;

This defines ThresholdFilterType a type for a binary threshold filter that
takes as input a 3D image of shorts and whose output is a 3D image of
shorts. This is the good thing of generic programming, once you have used
ImageType through your code you can change the definition of what ImageType
is an your code still compiles and runs (maybe with a few more changes).

Of course you can do things more complicated like

const     unsigned int Dimension = 3;
typedef   short InputPixelType;
typedef   unsigned char OutputPixelType;
typedef itk::Image< InputPixelType, Dimension >  InputImageType;
typedef itk::Image< OutputPixelType, Dimension >  OutputImageType;
typedef itk::BinaryThresholdImageFilter< InputImageType, OutputImageType >
ThresholdFilterType;

which in this case is more appropiate for thresholding, as you probably
won't need an image of shorts to store the result of a thresholding
operations. Note, that in most of the filters (there are exceptions) the
input and output images should have the same dimension but not necessarily
the same pixel type. Anyway, one should be extremely careful when choosing
pixel types as in some cases you may have unexpected behaviours/results.

Best regards

Iván



-----Mensaje original-----
De: insight-users-bounces+imacia=vicomtech.es at itk.org
[mailto:insight-users-bounces+imacia=vicomtech.es at itk.org] En nombre de
Maria Cira Avvinto
Enviado el: martes, 05 de diciembre de 2006 12:42
Para: insight-users
Asunto: [Insight-users] LaplacianSegmentationLevelSetImageFilter and 3Dimage

Thanks a much to Ivàn and Dan;
if i have understand, i must only  change :

"const     unsigned int    Dimension = 2;
  typedef itk::Image< InternalPixelType, Dimension >  InternalImageType;"
             into :

"const     unsigned int    Dimension = 3;
  typedef itk::Image< InternalPixelType, Dimension >  InternalImageType; ".

So shell I do this change for each filter that is included?

#include "itkImage.h"
#include "itkLaplacianSegmentationLevelSetImageFilter.h"
#include "itkGradientAnisotropicDiffusionImageFilter.h"
#include "itkFastMarchingImageFilter.h"
#include "itkBinaryThresholdImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkZeroCrossingImageFilter.h"

Thanks a lot,
Mary
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.15.7/569 - Release Date: 05/12/2006
3:00
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.15.7/569 - Release Date: 05/12/2006
3:00
 



More information about the Insight-users mailing list