<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=780393811-31082005><FONT face=Arial color=#0000ff size=2>The
print out of filter->GetOutput()->Print(std::cout) indicates the
image has not data. All the sizes of the regions are [0,0]. For
whatever reason, "filter" is producing no output. Is it getting any
input? I would print out the input to filter and the outputs of anything
before filter.</FONT></SPAN></DIV>
<DIV><SPAN class=780393811-31082005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=780393811-31082005><FONT face=Arial color=#0000ff size=2>I
believe the ImageFileWriter collapses unused dimensions, so it is probably
giving the PNGImageIO a zero dimensonal image.</FONT></SPAN></DIV>
<BLOCKQUOTE>
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
insight-users-bounces+millerjv=crd.ge.com@itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com@itk.org]<B>On Behalf Of
</B>Seniha Esen Yuksel<BR><B>Sent:</B> Tuesday, August 30, 2005 7:27
PM<BR><B>To:</B> insight-users@itk.org<BR><B>Subject:</B> [Insight-users]
ERROR: PNG Writer can only write 2-dimensionalimages<BR><BR></FONT></DIV>
<DIV>
<DIV>Hi all,</DIV>
<DIV>I had asked this question before unfortunately, and now I
am extending it with minor changes, but the problem is still the
same. Please give me some clues, ideas, just anything that comes to your
mind... </DIV>
<DIV> </DIV>
<DIV>What does it mean</DIV>
<DIV> </DIV>
<DIV>Description: itk::ERROR: PNGImageIO(026955F0): PNG Writer can only write
2-dimen<BR>sional images</DIV>
<DIV> </DIV>
<DIV>And yes I am asking for a 2D image as well ....??</DIV>
<DIV> </DIV>
<DIV>Here is the question: I am trying to use Qt+ITK to test some
functions, so I want to define a public filter in Qt's
main function which I will use as a buffer to hold my
images, but I am getting an exception error (as above). I don't
understand if my declerations are wrong, or if only the image writing stage is
wrong or else...</DIV>
<DIV> </DIV>
<DIV>The output of my code is:</DIV>
<DIV> </DIV>
<DIV>This program resizes the input file with the following parameters<BR>x
starting value: 300<BR>y starting value: 200<BR>x
extension : 400<BR>y extension
: 400<BR>===========================</DIV>
<DIV>images are cropped</DIV>
<DIV>Image (02685C30)<BR> RTTI typeinfo: class
itk::Image<unsigned char,2><BR> Reference Count: 1<BR>
Modified Time: 231<BR> Debug: Off<BR>
Observers:<BR> none<BR> Source: (02685D20)<BR>
Source output index: 0<BR> Release Data: Off<BR> Data Released:
False<BR> Global Release Data: Off<BR> PipelineMTime:
218<BR> UpdateMTime: 232<BR>
LargestPossibleRegion:<BR> Dimension:
2<BR> Index: [0, 0]<BR> Size: [0,
0]<BR> BufferedRegion:<BR> Dimension:
2<BR> Index: [0, 0]<BR> Size: [0,
0]<BR> RequestedRegion:<BR> Dimension:
2<BR> Index: [0, 0]<BR> Size: [0,
0]<BR> Spacing: [1, 1]<BR> Origin: [300, 200]<BR>
PixelContainer:<BR> ImportImageContainer
(02684BE0)<BR> RTTI typeinfo: class
itk::ImportImageContainer<unsigned long,unsigned
ch<BR>ar><BR> Reference Count:
1<BR> Modified Time:
230<BR> Debug:
Off<BR>
Observers:<BR>
none<BR> Pointer:
02684C10<BR> Container manages memory:
true<BR> Size:
0<BR> Capacity: 0<BR>Exception caught:</DIV>
<DIV>itk::ExceptionObject (0109E460)<BR>Location: "Unknown"<BR>File:
D:\Esen\C++ STUFF\C++
LIBRARIES\ITK\InsightToolkit-2.0.0\Code\IO\itkPNGIma<BR>geIO.cxx<BR>Line:
395<BR>Description: itk::ERROR: PNGImageIO(026857F0): PNG Writer can only
write 2-dimen<BR>sional images</DIV>
<DIV><BR> </DIV>
<DIV> </DIV>
<DIV>I am copying parts of the code below from the header file and the c++
file. </DIV>
<DIV> </DIV>
<DIV>
<DIV>//------------------------------------------------------------------------------</DIV></DIV>
<DIV>//part of the code from my .h file:</DIV>
<DIV>
<DIV>//------------------------------------------------------------------------------</DIV>
<DIV> </DIV></DIV>
<DIV>public:</DIV>
<DIV> </DIV>
<DIV>// ........</DIV>
<DIV> </DIV>
<DIV>//===================<BR>//My ITK Object
Pointers<BR>//===================<BR> </DIV>
<DIV> typedef int integer;<BR> typedef unsigned
short PixelType;</DIV>
<DIV> typedef unsigned char InputPixelType;<BR>
typedef unsigned char OutputPixelType;<BR> typedef
itk::Image< InputPixelType, 2 >
InputImageType;<BR> typedef itk::Image< OutputPixelType, 2
> OutputImageType;<BR> typedef
itk::RegionOfInterestImageFilter<InputImageType, OutputImageType >
FilterType;<BR> typedef itk::ImageFileWriter< OutputImageType>
WriterTypeGL;</DIV>
<DIV> <BR> FilterType::Pointer filter ;</DIV>
<DIV> WriterTypeGL::Pointer writergl;</DIV>
<DIV><BR> typedef InputImageType::RegionType RegionType;</DIV>
<DIV> </DIV>
<DIV><BR> // ........</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>//------------------------------------------------------------------------------</DIV>
<DIV>//-------------------- part of my c++ code
--------------------------</DIV>
<DIV> </DIV>
<DIV>int FrontDialog::CropImage(){</DIV>
<DIV> </DIV>
<DIV>//...........................</DIV>
<DIV> </DIV>
<DIV>writerMoving->SetInput( cropMoving->GetOutput()
);<BR> <BR> try
{<BR>
writerMoving->Update();<BR>
} catch (itk::ExceptionObject
&err)
{<BR> std::cout<<
"Exception caught in writing the moving image:" <<
std::endl;<BR>
std::cout<< err
<<std::endl;<BR>
<BR> return
-1;<BR> }<BR> </DIV>
<DIV> cout << "images are cropped \n" << endl;</DIV>
<DIV> </DIV>
<DIV>//here I definitely know that cropMoving->GetOutput() gives
correct results</DIV>
<DIV>//because I am able to save it as an image. However, I also want to save
it in a</DIV>
<DIV>//public variable to use over and over.</DIV>
<DIV> </DIV>
<DIV>//here comes the part which fails:</DIV>
<DIV> </DIV>
<DIV> RegionType regionGL;<BR> regionGL.SetSize(Width,
Height);<BR> regionGL.SetIndex(0,0);</DIV>
<DIV><BR> filter =
FilterType::New();<BR> filter->SetRegionOfInterest(regionGL);<BR> filter->SetInput(
cropMoving->GetOutput());</DIV>
<DIV> </DIV>
<DIV> try {<BR>
filter->Update();<BR>
} catch (itk::ExceptionObject
&err)
{<BR> std::cout<<
"Exception caught:" <<
std::endl;<BR>
std::cout<< err
<<std::endl;<BR> return
-1;<BR> }</DIV>
<DIV><BR> filter->GetOutput()->Print( std::cout );</DIV>
<DIV> </DIV>
<DIV> writergl = WriterTypeGL::New();<BR> writergl->SetFileName(
"test.png" );<BR> writergl->SetInput(filter->GetOutput());</DIV>
<DIV> try {<BR>
writergl->Update();<BR>
} catch (itk::ExceptionObject
&err)
{<BR> std::cout<<
"Exception caught:" <<
std::endl;<BR>
std::cout<< err
<<std::endl;<BR>
<BR> return
-1;<BR> }</DIV>
<DIV> </DIV>
<DIV>return 0;</DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>//-------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV>If I couldn't express my problem clearly, I am very sorry. I would be
glad to send the whole project though... I will really appreciate it a
lot if anyone could help me...</DIV>
<DIV>
<DIV>Thanks a lot !</DIV>
<DIV>Seniha</DIV>
<DIV> </DIV>
<DIV>PS: I have an idea that even if I got the previous code working, it
will not do the thing I want, or will it? What should I do?</DIV>
<DIV> </DIV>
<DIV> </DIV></DIV></DIV>
<P>
<HR SIZE=1>
Yahoo! Mail for Mobile<BR><A
href="http://us.rd.yahoo.com/evt=31132/*http://mobile.yahoo.com/learn/mail">Take
Yahoo! Mail with you!</A> Check email on your mobile
phone.</BLOCKQUOTE></BODY></HTML>