[Insight-users] output image with different grey levels

Giorgos Pichis gpichis at gmail.com
Wed Apr 2 06:40:27 EDT 2008


Hi there,
I tried to solve the problem using RescaleIntensityImageFilter but it didnt
fix the problem.
The input image has greylevel values from 0-1362 and the output image from
0-220.
In another example input image had values from 0-376 and the output from
0-241.
it seems that the writer by default writes the images in the scale 0-255,
but rescaling to 0-512 or 0-1024 didnt fix the problem

Thanks ,
Giorgos

On Tue, Apr 1, 2008 at 11:48 AM, Oliver Trebbe <otrebbe at uni-muenster.de>
wrote:

> Hi there,
> I think i also have the same Problem.
> After filtering and resampling my greylevel scale reached form ~ -30000 to
> ~+30000.
> Im also a little bit confused (tried to change the input pixel types, but
> that didnt work:))
> But i also use the RescaleIntensityImageFilter.
> Maybe this can help solving the problem.
>
> Greatings
> Oliver
>
>
> Giorgos Pichis schrieb:
>
> > Hi Luis,
> > Here is the code I used. It is the example ResampleImageFilter5 with a
> > change in the transform.
> > The images were dicom mammography 3d images.
> > The same problem appeared when I used .vtk 3d images . I didnt changed
> > the input and output pixel type
> >
> > Thanks ,
> > Giorgos
> >
> >
> > #include "itkImage.h"
> > #include "itkImageFileReader.h"
> > #include "itkImageFileWriter.h"
> > #include "itkResampleImageFilter.h"
> > #include "itkLinearInterpolateImageFunction.h"
> > #include "itkSimilarity3DTransform.h"
> >
> > int main( int argc, char * argv[] )
> > {
> >  if( argc < 5 )
> >    {
> >    std::cerr << "Usage: " << std::endl;
> >    std::cerr << argv[0] << "  inputImageFile  outputImageFile  degrees
> >  scale" << std::endl;
> >    return EXIT_FAILURE;
> >    }
> >
> >  const     unsigned int   Dimension = 3;
> >  typedef   unsigned char  InputPixelType;
> >  typedef   unsigned char  OutputPixelType;
> >
> >  typedef itk::Image< InputPixelType,  Dimension >   InputImageType;
> >  typedef itk::Image< OutputPixelType, Dimension >   OutputImageType;
> >
> >  typedef itk::ImageFileReader< InputImageType  >  ReaderType;
> >  typedef itk::ImageFileWriter< OutputImageType >  WriterType;
> >
> >  ReaderType::Pointer reader = ReaderType::New();
> >  WriterType::Pointer writer = WriterType::New();
> >
> >  reader->SetFileName( argv[1] );
> >  writer->SetFileName( argv[2] );
> >    typedef itk::Similarity3DTransform< double >  TransformType;
> >  TransformType::Pointer transform = TransformType::New();
> >
> >  typedef TransformType::ParametersType ParametersType;
> >  ParametersType parameters;
> >   double angleInDegrees = atof( argv[3] );
> >     double scale          = atof( argv[4] );
> >    transform->SetScale(scale);
> >  typedef itk::ResampleImageFilter<
> >                  InputImageType, OutputImageType >  FilterType;
> >
> >  FilterType::Pointer filter = FilterType::New();
> >
> >
> >  typedef itk::LinearInterpolateImageFunction<
> >                       InputImageType, double >  InterpolatorType;
> >  InterpolatorType::Pointer interpolator = InterpolatorType::New();
> >    filter->SetInterpolator( interpolator );
> >
> >  filter->SetDefaultPixelValue( 0 );
> >
> >  reader->Update();
> >  const InputImageType::SpacingType&
> >    spacing = reader->GetOutput()->GetSpacing();
> >  const InputImageType::PointType&
> >    origin  = reader->GetOutput()->GetOrigin();
> >  InputImageType::SizeType size =
> >      reader->GetOutput()->GetLargestPossibleRegion().GetSize();
> >
> >  filter->SetOutputOrigin( origin );
> >  filter->SetOutputSpacing( spacing );
> >  filter->SetSize( size );
> >
> >
> >  filter->SetInput( reader->GetOutput() );
> >  writer->SetInput( filter->GetOutput() );
> >  TransformType::InputPointType rotationCenter;
> >  rotationCenter[0] = origin[0] + spacing[0] * size[0] / 2.0;
> >  rotationCenter[1] = origin[1] + spacing[1] * size[1] / 2.0;
> >  rotationCenter[2] = origin[2] + spacing[2] * size[2] / 2.0;
> >  transform->SetCenter( rotationCenter );
> >
> >  typedef TransformType::VersorType VersorType;
> >  typedef VersorType::VectorType VectorType;
> >  VersorType rotation;
> >  VectorType axis;
> >  axis[0]=0.0;
> >  axis[1]=0.0;
> >  axis[2]=1.0;
> >   double degreesToRadians = atan(1.0) / 45.0;
> >    const double angle = angleInDegrees * degreesToRadians;
> >  rotation.Set (axis, angle);
> >  transform->SetRotation( rotation );
> >    TransformType::OutputVectorType translation;
> >
> >  translation[0] =   0.0;
> >  translation[1] =   0.0;
> >  translation[2] =   0.0;
> >  transform->SetTranslation (translation);
> >
> >  filter->SetTransform( transform );
> >
> >  try
> >    {
> >    writer->Update();
> >    }
> >  catch( itk::ExceptionObject & excep )
> >    {
> >    std::cerr << "Exception catched !" << std::endl;
> >    std::cerr << excep << std::endl;
> >    }
> >  return EXIT_SUCCESS;
> > }
> >
> >
> > On Fri, Mar 28, 2008 at 6:18 PM, Luis Ibanez <luis.ibanez at kitware.com<mailto:
> > luis.ibanez at kitware.com>> wrote:
> >
> >    Hi Giorgos,
> >
> >    1) How different are the intensities of the output image ?
> >
> >    2) What Transform are you using ?
> >
> >    3) What interpolator are you using ?
> >
> >    4) What image type did you defined for the input ?
> >
> >    5) What image type did you defined for the output ?
> >
> >    6) What is the modality of the input image ?
> >
> >    ...
> >
> >    7) Please post your code to the list.
> >
> >
> >      Thanks
> >
> >
> >         Luis
> >
> >
> >    -----------------------
> >    Giorgos Pichis wrote:
> >    > Hi there,
> >    > I tried to resample a 3d image (.vtk) with a transformation,
> >    > but the output image (  writer->SetInput(filter->GetOutput() );   )
> >    > had different intensity values than the input image.
> >    > Do you know what might be the problem?
> >    > Thanks
> >    >
> >    >
> >    >
> >
> >  ------------------------------------------------------------------------
> >    >
> >    > _______________________________________________
> >    > Insight-users mailing list
> >    > Insight-users at itk.org <mailto:Insight-users at itk.org>
> >    > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080402/9fb6336e/attachment-0001.htm>


More information about the Insight-users mailing list