[Insight-users] Why MultiResolutionPyramidImageFilter does not produce right image?

Zhiyong Xie zyxie98 at yahoo.com
Thu, 5 Feb 2004 08:51:26 -0800 (PST)


--0-2105917344-1075999886=:45247
Content-Type: text/plain; charset=us-ascii

Lydia:
 
In MultiResolutionPDEDeformableRegistration, it seems we cannot set the schedule
of image pyramid (which is provide by SetSchedule method in MultiResolutionPyramidImageFilter ).  It will be convenient if we can set different shrink
factor for each dimensions and for each image (fixed and moving) through
MultiResolutionPDEDeformableRegistration. I am not sure whether
we can do it in current implmentation. otherwise, it will be nice if the code can be
modified by implementing method SetFixedImagePyramid and SetMovingImagePyramid,
as well as a little change in GenerateData, where moving and fixed images can be 
retrived from image pyramid instead of creating pyramid form image, if the pyramid 
have already been set.
 
Thanks
 
Sean
 

Lydia Ng <lng at insightful.com> wrote:
Hi Fucang,

I think the filter requires the output pixel type to be floating point. Could
you try it out as an experiment?

- Lydia

> -----Original Message-----
> From: Fucang Jia [mailto:jiafucang at hotmail.com]
> Sent: Wednesday, November 19, 2003 1:17 AM
> To: insight-users at itk.org
> Subject: [Insight-users] Why MultiResolutionPyramidImageFilter does not
> produce right image?
> 
> Hi, everyone,
> 
> I am using ITK 1.4 and want to do some experiments based on
> MultiResolutionPyramid. But the following program does not give correct
> images. It does produce 8 images, but the first level image is all zeros.
> So
> the error spreads to the next level images. Is there some error in this
> program?
> 
> Thanks a lot!
> 
> Fucang
> 
> 
> =============================
> int main(int argc, char *argv[] )
> {
> 
> 
> if(argc<2)
> {
> std::cerr<> return -1;
> }
> 
> typedef unsigned short PixelType;
> const unsigned short Dimension = 2;
> 
> typedef itk::Image
 InputImageType;
> typedef itk::Image
 OutputImageType;
> typedef itk::ImageFileReader [input]  ReaderType;
> typedef itk::ImageFileWriter WriterType;
> typedef
> itk::MultiResolutionPyramidImageFilter [input] 
> PyramidType;
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
> PyramidType::Pointer pyramid = PyramidType::New();
> 
> 
> reader->SetFileName(argv[1]);
> reader->Update();
> 
> pyramid->SetInput( reader->GetOutput() );
> 
> unsigned int numLevels;
> itk::Vector factors;
> 
> numLevels = 8;
> factors[0] = 256; factors[1] = 256;
> 
> pyramid->SetNumberOfLevels( numLevels );
> pyramid->SetStartingShrinkFactors( 256 );
> pyramid->Print( std::cout );
> 
> pyramid->Update();
> 
> for (int i=0;i> {
> char str[4096];
> sprintf(str,"test_%d.png",i);
> writer->SetFileName(str);
> writer->SetInput(pyramid->GetOutput(i));
> writer->Update();
> }
> 
> return 0;
> }
> 
> _________________________________________________________________
> The new MSN 8: advanced junk mail protection and 2 months FREE*
> http://join.msn.com/?pagežatures/junkmail
> 
> _______________________________________________
> Insight-users mailing list
> 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

---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online
--0-2105917344-1075999886=:45247
Content-Type: text/html; charset=us-ascii

<DIV>Lydia:</DIV>
<DIV>&nbsp;</DIV>
<DIV>In MultiResolutionPDEDeformableRegistration, it seems we cannot set the schedule</DIV>
<DIV>of image pyramid (which is provide by SetSchedule method in MultiResolutionPyramidImageFilter ).&nbsp;&nbsp;It will be convenient if we can set different shrink</DIV>
<DIV>factor for&nbsp;each dimensions and for each image (fixed and moving) through</DIV>
<DIV>MultiResolutionPDEDeformableRegistration. I am not sure whether</DIV>
<DIV>we can do it in current implmentation. otherwise, it will be nice if the code can be</DIV>
<DIV>modified&nbsp;by implementing&nbsp;method SetFixedImagePyramid and SetMovingImagePyramid,</DIV>
<DIV>as well as a little change in GenerateData, where moving and fixed images can be </DIV>
<DIV>retrived from image pyramid instead of creating pyramid form image, if the pyramid </DIV>
<DIV>have already been set.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks</DIV>
<DIV>&nbsp;</DIV>
<DIV>Sean</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR><B><I>Lydia Ng &lt;lng at insightful.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi Fucang,<BR><BR>I think the filter requires the output pixel type to be floating point. Could<BR>you try it out as an experiment?<BR><BR>- Lydia<BR><BR>&gt; -----Original Message-----<BR>&gt; From: Fucang Jia [mailto:jiafucang at hotmail.com]<BR>&gt; Sent: Wednesday, November 19, 2003 1:17 AM<BR>&gt; To: insight-users at itk.org<BR>&gt; Subject: [Insight-users] Why MultiResolutionPyramidImageFilter does not<BR>&gt; produce right image?<BR>&gt; <BR>&gt; Hi, everyone,<BR>&gt; <BR>&gt; I am using ITK 1.4 and want to do some experiments based on<BR>&gt; MultiResolutionPyramid. But the following program does not give correct<BR>&gt; images. It does produce 8 images, but the first level image is all zeros.<BR>&gt; So<BR>&gt; the error spreads to the next level images. Is there some error in this<BR>&gt; program?<BR>&gt; <BR>&gt; Thanks a lot!<BR>&gt; <BR>&gt; Fucang<BR>&gt; <BR>&gt; <BR>&gt;
 =============================<BR>&gt; int main(int argc, char *argv[] )<BR>&gt; {<BR>&gt; <BR>&gt; <BR>&gt; if(argc&lt;2)<BR>&gt; {<BR>&gt; std::cerr&lt;<ARGV[0]<<" Input2DImage?<<std::endl;<br>&gt; return -1;<BR>&gt; }<BR>&gt; <BR>&gt; typedef unsigned short PixelType;<BR>&gt; const unsigned short Dimension = 2;<BR>&gt; <BR>&gt; typedef itk::Image<PIXELTYPE,DIMENSION> InputImageType;<BR>&gt; typedef itk::Image<PIXELTYPE,DIMENSION> OutputImageType;<BR>&gt; typedef itk::ImageFileReader<INPUTIMAGETYPE> ReaderType;<BR>&gt; typedef itk::ImageFileWriter<OUTPUTIMAGETYPE> WriterType;<BR>&gt; typedef<BR>&gt; itk::MultiResolutionPyramidImageFilter<INPUTIMAGETYPE,OUTPUTIMAGETYPE><BR>&gt; PyramidType;<BR>&gt; ReaderType::Pointer reader = ReaderType::New();<BR>&gt; WriterType::Pointer writer = WriterType::New();<BR>&gt; PyramidType::Pointer pyramid = PyramidType::New();<BR>&gt; <BR>&gt; <BR>&gt; reader-&gt;SetFileName(argv[1]);<BR>&gt; reader-&gt;Update();<BR>&gt; <BR>&gt; pyramid-&gt;SetInput(
 reader-&gt;GetOutput() );<BR>&gt; <BR>&gt; unsigned int numLevels;<BR>&gt; itk::Vector<UNSIGNED int,Dimension> factors;<BR>&gt; <BR>&gt; numLevels = 8;<BR>&gt; factors[0] = 256; factors[1] = 256;<BR>&gt; <BR>&gt; pyramid-&gt;SetNumberOfLevels( numLevels );<BR>&gt; pyramid-&gt;SetStartingShrinkFactors( 256 );<BR>&gt; pyramid-&gt;Print( std::cout );<BR>&gt; <BR>&gt; pyramid-&gt;Update();<BR>&gt; <BR>&gt; for (int i=0;i<NUMLEVELS;I++)<BR>&gt; {<BR>&gt; char str[4096];<BR>&gt; sprintf(str,"test_%d.png",i);<BR>&gt; writer-&gt;SetFileName(str);<BR>&gt; writer-&gt;SetInput(pyramid-&gt;GetOutput(i));<BR>&gt; writer-&gt;Update();<BR>&gt; }<BR>&gt; <BR>&gt; return 0;<BR>&gt; }<BR>&gt; <BR>&gt; _________________________________________________________________<BR>&gt; The new MSN 8: advanced junk mail protection and 2 months FREE*<BR>&gt; http://join.msn.com/?pagežatures/junkmail<BR>&gt; <BR>&gt; _______________________________________________<BR>&gt; Insight-users mailing list<BR>&gt;
 Insight-users at itk.org<BR>&gt; http://www.itk.org/mailman/listinfo/insight-users<BR>_______________________________________________<BR>Insight-users mailing list<BR>Insight-users at itk.org<BR>http://www.itk.org/mailman/listinfo/insight-users</BLOCKQUOTE><p><hr SIZE=1>
Do you Yahoo!?<br>
Yahoo! Finance: <a href="http://us.rd.yahoo.com/evt=22055/*http://taxes.yahoo.com/filing.html">Get your refund fast by filing online</a>
--0-2105917344-1075999886=:45247--