[Insight-users] Problem writing small images

Chris Farmer cfarmer at scitegic.com
Tue Jan 17 18:14:18 EST 2006


 
Hi all,
 
I have a collection of potentially many images that I'm trying to write
out as files.  Most of these images are small, and some are only 1 pixel
in size.  I seem to have a problem with any images that are 1x1, 1x2, or
2x1 in size.  Images that are 2x2 in size or bigger don't seem to have a
problem.  I get an error like this:
 
itk::ERROR: PNGImageIO(064DD690): PNG Writer can only write
2-dimensional images. You are requesting to write an image of dimension
= 0 with filename C:\images\1x2output.png
 
My code is straightforward....
 
itk::ImageFileReader<Grayscale8ImageType>::Pointer r =
itk::ImageFileReader<Grayscale8ImageType>::New();
itk::ImageFileWriter<Grayscale8ImageType>::Pointer w =
itk::ImageFileWriter<Grayscale8ImageType>::New();
r->SetFileName("C:\\images\\1x2black.tif");
w->SetFileName("C:\\images\\1x2output.png");
w->SetInput(r->GetOutput());
w->Update();
 
A similar error occurs for other output types that I tried.  Is there
anything I can do to write out a small file like this?  Yeah, I know
there's not much to be gained by looking at a 1-by-1 image, but...
 
I'm currently using ITK 2.2 on Windows, but am not opposed to updating
to a newer version.  My test images are linked below.  I don't have my
own publicly accessible web server, and all my tif files seem to get
converted to png at the free image hosting sites, but png source files
seem to give the same error.
 
http://xs64.xs.to/pics/06033/1x1black.png
http://xs64.xs.to/pics/06033/1x2black.png
 
 
 
thanks,
Chris
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060117/4f4855d8/attachment.htm


More information about the Insight-users mailing list