[Insight-users] Compiling ITK on Windows: PNG problems

Raghavendra Chandrashekara rc3@doc.ic.ac.uk
Thu, 6 Mar 2003 12:12:19 -0000


Hi Mathieu,

Thanks very much for your help! Adding your lines worked but not on the
ramp.gipl image in the Testing/Data/Input directory. I used one of our own
GIPL images. Do you think the ramp.gipl image has been corrupted?

Also shouldn't the first method work where you don't actually set the
GiplImageIO reader type?

Thanks,

Raghavendra

----- Original Message -----
From: "Mathieu Malaterre" <Mathieu.Malaterre@creatis.insa-lyon.fr>
To: "Raghavendra Chandrashekara" <rc3@doc.ic.ac.uk>
Cc: "Luis Ibanez" <luis.ibanez@kitware.com>;
<insight-users@public.kitware.com>
Sent: Thursday, March 06, 2003 11:13 AM
Subject: Re: [Insight-users] Compiling ITK on Windows: PNG problems


> Raghavendra,
>
> What is the extention of you file, please. This is very important in
> the IOFactory process.
>
>
> ---
>
> In case it was .gipl. I suggest you to try adding those lines:
>
> [snip]
>
>      typedef  itk::GiplImageIO<PixelType, 3> GiplReaderType;  //here
>      GiplReaderType::Pointer giplIO = GiplReaderType::New();
>
>      pReader->SetFileName(argv[1]);
>      pWriter->SetFileName(argv[2]);
>
>      pReader->SetImageIO( giplIO ); //here
>
>      pWriter->SetInput(pReader->GetOutput());
>
> [snip]
>
> HTH
> mathieu
>
> Raghavendra Chandrashekara wrote:
> > Hi Luis,
> >
> > Thanks for your help. I tried building everything from scratch (after
> > removing any png.dll files on my system) but with no luck. I must be
doing
> > something wrong with the configuration. Well anyway I stopped the png
> > library from being built as you suggested and managed to get the test
> > program to build properly. Now when I run the program using the image in
> > Testing/Data/Input/ramp.gipl as input an exception is produced and this
is
> > the error message I get:
> >
> > Exception object caught!
> >
> > itk::ExceptionObject (00DFF304)
> > Location: "Unknown"
> > File: \packages\InsightCVS\Code\IO\itkAnalyzeImageIO.cxx
> > Line: 796
> > Description: File cannot be read
> >
> > Is this a possible bug? It seems strange that the Analyze image IO
object is
> > the one causing the exception and not the GIPL image IO. I've attached
the
> > source code.
> >
> > Thanks,
> >
> > Raghavendra.
> >
> > ----- Original Message -----
> > From: "Luis Ibanez" <luis.ibanez@kitware.com>
> > To: "Raghavendra Chandrashekara" <rc3@doc.ic.ac.uk>
> > Cc: <insight-users@public.kitware.com>
> > Sent: Wednesday, March 05, 2003 7:37 PM
> > Subject: Re: [Insight-users] Compiling ITK on Windows: PNG problems
> >
> >
> >
> >>Hi Raghavendra
> >>
> >>
> >>Did you searched for a png.dll  ?
> >>
> >>Another possibility is that your png library is not
> >>being rebuilt...
> >>
> >>Have you tried with a clean build from scractch ?
> >>
> >>-------
> >>
> >>If you want to get around this and disable PNG
> >>you can modify the CMakeLists.txt files in the
> >>following directories:
> >>
> >>
> >>1) Insight/Utilities/
> >>    (remove  "png" in the SUBDIRS command) that
> >>    will prevent png from being built
> >>
> >>2) Insight/Code/IO
> >>    remove PNGImageIO and PNGImageIOFactory from
> >>    the list of sources.
> >>
> >>
> >>Note that this is not a "solution", just a desperate
> >>attempt to get around the real problem.
> >>
> >>PNG is build nightly and continuosly in all the
> >>platforms you see in the dashboard. So it is very
> >>likely that the problem is related configuration
> >>of your specific system.
> >>
> >>
> >>
> >>
> >>    Luis
> >>
> >>
> >>------------------------------------------------------------------------
> >>
> >>PROJECT(ITKGIPLImageTest)
> >>
> >>INCLUDE(${CMAKE_ROOT}/Modules/FindITK.cmake)
> >>IF (USE_ITK_FILE)
> >> INCLUDE(${USE_ITK_FILE})
> >>ENDIF (USE_ITK_FILE)
> >>
> >>ADD_EXECUTABLE(ITKGIPLImageTest ITKGIPLImageTest.cxx)
> >>
> >>IF (WIN32)
> >> TARGET_LINK_LIBRARIES(ITKGIPLImageTest ITKIO ITKCommon ITKMetaIO
VXLNumerics)
> >>ELSE (WIN32)
> >> TARGET_LINK_LIBRARIES(ITKGIPLImageTest ITKIO ITKCommon ITKMetaIO
VXLNumerics dl pthread)
> >>ENDIF (WIN32)
> >>
> >>
> >>------------------------------------------------------------------------
> >>
> >>#include <iostream>
> >>
> >>using namespace std;
> >>
> >>#include "itkImage.h"
> >>#include "itkImageFileReader.h"
> >>#include "itkImageFileWriter.h"
> >>
> >>/* Program reads a GIPl image and writes it out again. */
> >>int main(int argc, char** argv)
> >>{
> >>  if (argc != 3) {
> >>    std::cout << "Usage: ITKGIPLImageTest input.gipl output.gipl" <<
std::endl;
> >>    exit(1);
> >>  }
> >>
> >>  typedef short PixelType;
> >>  typedef itk::Image<PixelType, 3> ImageType;
> >>  typedef itk::ImageFileReader<ImageType> ReaderType;
> >>  typedef itk::ImageFileWriter<ImageType> WriterType;
> >>
> >>  try {
> >>    ReaderType::Pointer pReader = ReaderType::New();
> >>    WriterType::Pointer pWriter = WriterType::New();
> >>
> >>    pReader->SetFileName(argv[1]);
> >>    pWriter->SetFileName(argv[2]);
> >>
> >>    pWriter->SetInput(pReader->GetOutput());
> >>
> >>    pWriter->Update();
> >>  }
> >>  catch (itk::ExceptionObject& ex) {
> >>    std::cout << "Exception object caught!" << std::endl;
> >>    std::cout << ex << std::endl;
> >>    exit(1);
> >>  }
> >>
> >>  return 0;
> >>}
>
>
> --
> Mathieu Malaterre
> CREATIS
> 28 Avenue du Doyen LEPINE
> B.P. Lyon-Montchat
> 69394 Lyon Cedex 03
> http://www.creatis.insa-lyon.fr/~malaterre/
>
>