[Insight-users] [Gdcm2] Bad rescale slope/intercept with gdcm 2.0.15 via itkGDCMImageIO

Roger Bramon Feixas rogerbramon at gmail.com
Thu Jul 29 04:29:42 EDT 2010


Hi,

I'm working with Jesús and we found the problem: we upgraded from GDCM
2.0.14 to 2.0.15 but ITK 3.18 wasn't been rebuilt. However, we need to build
GDCM 2.0.15 with VTK support but then it isn't possible to build ITK using
external GDCM 2.0.15+VTK as we're discussing here:
http://www.itk.org/pipermail/insight-users/2010-July/037515.html.

Have you found a solution to be able to compile ITK?

Thanks!

Roger

On Tue, Jul 27, 2010 at 1:34 PM, Mathieu Malaterre <
mathieu.malaterre at gmail.com> wrote:

> You said you were using ITK+GDCM2. If this is the case then this is
> already integrated for you.
>
> BTW, this does not impact CT, so there is something else going on, on
> your setup.
>
> HTH
>
> On Tue, Jul 27, 2010 at 1:13 PM, Jesús Spí­nola <jspinola at gmail.com>
> wrote:
> > Hi Mathieu,
> > I get the same result as you running "gdcmviewer". The issue is occurring
> > under windows, I haven't tested under any other operating system.
> > How can I achieve the "--force-rescale" behaviour with my sample program?
> > I'll take a look to the gdcmviewer app too.
> >
> > On Fri, Jul 23, 2010 at 7:17 PM, Mathieu Malaterre
> > <mathieu.malaterre at gmail.com> wrote:
> >>
> >> Jesús,
> >>
> >>  First thing first what do you get when you run:
> >>
> >> $ gdcmviewer --force-rescale -V 05119865-mr-siemens-avanto-syngo.dcm
> >>
> >> I am getting:
> >>
> >> ...
> >>  Increments: (0, 0, 0)
> >>  Extent: (0, 447, 0, 335, 0, 0)
> >>
> >> Range: -1186 526
> >>
> >> Which seems about right, according to your number.
> >>
> >> Thanks !
> >>
> >>
> >> On Fri, Jul 23, 2010 at 10:56 AM, Jesús Spí­nola <jspinola at gmail.com>
> >> wrote:
> >> > Hi,
> >> > So far I was using gdcm 2.0.14 and I was able to read any image with
> no
> >> > problem, but I upgraded recently to gdcm 2.0.15 and I found a problem
> >> > reading some CT and MR DICOM image files.
> >> > The way I'm reading DICOM files is using itkGDCMImageIO with
> >> > itkImageSeriesReader and then filtering the output to vtk for the
> image
> >> > rendering.
> >> > The problem is that some images are now (gdcm 2.0.15) loaded with a
> >> > different scalar range than before (gdcm 2.0.14), hence they are not
> >> > displayed properly with the default window/level setting (almost
> >> > completely
> >> > white in most CT cases for instance). I observed that the images with
> >> > trouble were those containing rescale intercept/slope tags with some
> >> > value.
> >> > The images with no rescale intercept/slope present are displayed as
> >> > expected, so my guess is there is some problem regarding the
> >> > intercept/slope
> >> > rescale computation.
> >> > I've written a little program which reads a DICOM image and renders it
> >> > with
> >> > vtk to reproduce the bug. Then I compiled it against gdcm 2.0.14 and
> >> > 2.0.15
> >> > to see the differences between each other. The source code is at the
> end
> >> > of
> >> > this e-mail.
> >> > I've been testing with some DICOM images
> >> > from http://www.creatis.insa-lyon.fr/~jpr/PUBLIC/gdcm/gdcmData.tar.gz
> .
> >> > Some
> >> > of these test images are valid to reproduce the problem, in this case
> >> > I'll
> >> > show you the results with
> >> > MR-MONO2-12-shoulder.dcm, CT-SIEMENS-Icone-With-PaletteColor.dcm
> >> > and 05119865-mr-siemens-avanto-syngo.dcm.
> >> > In the following table I show some of the relevant information of each
> >> > image
> >> > and the scalar range I get building the program against gdcm 2.0.14
> and
> >> > 2.0.15. The right scalar range is the one obtained with gdcm 2.0.14.
> The
> >> > result is specially bad with the MR-MONO2-12-shoulder.dcm image.
> >> > File WW,WL Bits Allocated/Stored Rescale Slope/Intercept Scalar Range:
> >> > 2.0.14 Build           2.0.15 Build
> >> > MR-MONO2-12-shoulder.dcm 2000,1000 16/12 3.774114, 0.000061 0..2245
> >> > -32065..32556
> >> > CT-SIEMENS-Icone-With-PaletteColor.dcm 350,40 16/12 1, -1024
> -1024..981
> >> > 0..2005
> >> > 05119865-mr-siemens-avanto-syngo.dcm 1538,98 16/12 2, -4096 -1186..526
> >> > 1455..2311
> >> >
> >> > I tested with itk 3.18 and vtk 5.6,  (the vtk version might not make
> any
> >> > sense in the results because the problem is just in the reading
> stage).
> >> > (Look at some screenshots of the results)
> >> > //
> >> > // SOURCE CODE
> >> > //
> >> > //
> >> > // You'll need also itkImageToVTKImageFilter class, available in the
> >> > InsightApplications package under "Auxiliary\vtk" folder
> >> > //
> >> > // Usage: main.exe DICOMFilename [WindowWidth WindowLevel]
> >> > #include <vtkImageviewer2.h>
> >> > #include <vtkRenderWindowInteractor.h>
> >> > #include <vtkRenderWindow.h>
> >> > #include <itkImage.h>
> >> > #include <itkImageSeriesReader.h>
> >> > #include <itkGDCMImageIO.h>
> >> > #include "itkImageToVTKImageFilter.h" //Converts an ITK image into a
> VTK
> >> > image and plugs a itk data pipeline to a VTK datapipeline.
> >> > int main(int argc, char* argv[])
> >> > {
> >> >     // Voxel type and image dimension
> >> >     typedef signed short int VoxelType;
> >> >     typedef VoxelType ItkPixelType;
> >> >     static const unsigned int VDimension = 3;
> >> >     // Itk Image type
> >> >     typedef itk::Image<ItkPixelType, VDimension> ItkImageType;
> >> >     typedef ItkImageType::Pointer ItkImageTypePointer;
> >> >
> >> >     // Series reader
> >> >     typedef itk::ImageSeriesReader<ItkImageType> SeriesReaderType;
> >> >     typedef itk::GDCMImageIO ImageIOType;
> >> >     // itk2vtk filter
> >> >     typedef itk::ImageToVTKImageFilter<ItkImageType>
> ItkToVtkFilterType;
> >> >     /// DICOM Reader
> >> >     SeriesReaderType::Pointer m_seriesReader =
> SeriesReaderType::New();
> >> >     ImageIOType::Pointer m_gdcmIO = ImageIOType::New();
> >> >
> >> >     m_seriesReader->SetImageIO(m_gdcmIO);
> >> >     ItkToVtkFilterType::Pointer m_itkToVtkFilter =
> >> > ItkToVtkFilterType::New();
> >> >     // Check the number of parameters given
> >> >     if (argc >= 2)
> >> >     {
> >> >         // Create the renderer object and configure it
> >> >         vtkImageViewer2 *viewer = vtkImageViewer2::New();
> >> >         vtkRenderWindowInteractor *interactor =
> >> > vtkRenderWindowInteractor::New();
> >> >         viewer->SetupInteractor(interactor);
> >> >         // Set the first argument as the input filename to read
> >> >         // Atention: We don't check whether the file is valid or not
> >> >         m_seriesReader->SetFileName(argv[1]);
> >> >         m_itkToVtkFilter->SetInput(m_seriesReader->GetOutput());
> >> >         try
> >> >         {
> >> >             m_itkToVtkFilter->Update();
> >> >         }
> >> >         catch (itk::ExceptionObject & exception)
> >> >         {
> >> >             std::cerr << "Exception caught!" <<
> >> > exception.GetDescription()
> >> > << std::endl;
> >> >         }
> >> >         // Show some information about the image
> >> >         m_itkToVtkFilter->GetOutput()->Print(std::cout);
> >> >         std::cerr << "** Scalar Range **" << std::endl;
> >> >         std::cerr <<
> m_itkToVtkFilter->GetOutput()->GetScalarRange()[0]
> >> > <<
> >> > ".." << m_itkToVtkFilter->GetOutput()->GetScalarRange()[1] <<
> std::endl;
> >> >         // Set the viewer input (DICOM File) and do the rendering
> stuff
> >> >         viewer->SetInput(m_itkToVtkFilter->GetOutput());
> >> >
> >> >         // We can optionally set the window/level through the
> arguments
> >> >         if (argc >=4)
> >> >         {
> >> >             std::cout << "Applying given ww/wl: " << argv[2] << ", "
> <<
> >> > argv[3] << std::endl;
> >> >             viewer->SetColorWindow(atof(argv[2]));
> >> >             viewer->SetColorLevel(atof(argv[3]));
> >> >         }
> >> >         else
> >> >         {
> >> >             std::cout << "Applying default ww/wl: 256, 128" <<
> >> > std::endl;
> >> >             viewer->SetColorWindow(256);
> >> >             viewer->SetColorLevel(128);
> >> >         }
> >> >
> >> >         viewer->Render();
> >> >         interactor->Start();
> >> >     }
> >> >     else
> >> >     {
> >> >         std::cerr << "Usage: main.exe DICOMFilename [WindowWidth
> >> > WindowLevel]" << std::endl;
> >> >     }
> >> >     return 0;
> >> > }
> >> > --
> >> > Jesús Spínola
> >> >
> >> > _____________________________________
> >> > 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.html
> >> >
> >> > 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
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Mathieu
> >
> >
> >
> > --
> > Jesús Spínola
> >
>
>
>
> --
> Mathieu
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> Gdcm-developers mailing list
> Gdcm-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gdcm-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100729/54e28830/attachment-0001.htm>


More information about the Insight-users mailing list