[Insight-users] Extract Image Filter
Miller, James V (Research)
millerjv@crd.ge.com
Tue, 4 Feb 2003 12:40:53 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C2CC74.67843E52
Content-Type: text/plain
Luis,
Does this mean there is an issue with the FLTK image viewer? Is it triggering off the wrong Region?
Jim
-----Original Message-----
From: Puja Malik [mailto:puja.malik@MEMcenter.unibe.ch]
Sent: Tuesday, February 04, 2003 11:27 AM
To: itk newsgroup
Subject: [Insight-users] Extract Image Filter
Hi Luis,
I've managed to fix my problem in the ExtractImageFilter. I do have one concern though. I cannot
directly use the image object from the output of the filter, and view it in the fltk image filter.
If I do this, the images intensity range is altered, and the first slice is distorted. I must first
write the output of the filter ( image object ) to a file, read it back into a new image object and
then view it. This way, I see a correctly extracted image. This is very strange. It would be
convenient if the output of the filter could be used directly. Please see my code below, including
the extra steps I needed to perform to get the desired results.
void ExtractImageRegion(ImageType::Pointer imIN, ImageType::SizeType regSize,
ImageType::IndexType
regIndex)
{
typedef itk::ExtractImageFilter< ImageType, ImageType > FilterType;
FilterType::Pointer filter = FilterType::New();
ImageType::Pointer imOUT;
ImageType::RegionType region;
region.SetSize(regSize);
region.SetIndex(regIndex);
filter->SetExtractionRegion(region);
filter->SetInput(imIN);
filter->Update();
// View(filter->GetOutput(), "region"); <-- doing this directly shows a distorted image
//the following is the extra steps needed to view a correct image
//View, Read, WriteMetaFile are my own functions written using itk classes.
imOUT = filter->GetOutput();
imOUT->DisconnectPipeline();
ImageType::Pointer im;
WriteMetaFile("/home/encephalon/puja/testRegion.mhd", imOUT);
im=Read("/home/encephalon/puja/testRegion.mhd");
View(im, "region");
}
Thanks for your help,
Puja
--
---------------------------------------
Puja Malik
Surgical Instruments Group
MEM Research Center for Orthopaedic Surgery
Institute for Surgical Technology and Biomechanics
University of Bern
Murtenstrasse 35, P.O. Box 8354
3010 Bern, Switzerland
Phone: +41-31-632-8730
Fax: +41-31-632-4951
Email: Puja.Malik@MEMcenter.unibe.ch
http://www.MEMcenter.unibe.ch <http://www.MEMcenter.unibe.ch>
---------------------------------------
------_=_NextPart_001_01C2CC74.67843E52
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">
<META content=3D"MSHTML 6.00.2715.400" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D964263917-04022003><FONT color=3D#0000ff =
size=3D2>Luis,=20
</FONT></SPAN></DIV>
<DIV><SPAN class=3D964263917-04022003><FONT color=3D#0000ff=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D964263917-04022003><FONT color=3D#0000ff =
size=3D2>Does this mean=20
there is an issue with the FLTK image viewer? Is it triggering =
off the=20
wrong Region?</FONT></SPAN></DIV>
<DIV><SPAN class=3D964263917-04022003><FONT color=3D#0000ff=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D964263917-04022003><FONT color=3D#0000ff=20
size=3D2>Jim</FONT></SPAN></DIV>
<BLOCKQUOTE=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> Puja Malik=20
[mailto:puja.malik@MEMcenter.unibe.ch]<BR><B>Sent:</B> Tuesday, =
February 04,=20
2003 11:27 AM<BR><B>To:</B> itk newsgroup<BR><B>Subject:</B> =
[Insight-users]=20
Extract Image Filter<BR><BR></FONT></DIV>Hi Luis,=20
<P>I've managed to fix my problem in the ExtractImageFilter. =
I do=20
have one concern though. I cannot directly use the image object =
from the=20
output of the filter, and view it in the fltk image filter. If =
I do=20
this, the images intensity range is altered, and the first slice is=20
distorted. I must first write the output of the filter ( =
image=20
object ) to a file, read it back into a new image object and then =
view=20
it. This way, I see a correctly extracted image. This is =
very=20
strange. It would be convenient if the output of the filter =
could be=20
used directly. Please see my code below, including the extra =
steps I=20
needed to perform to get the desired results.=20
<P>void ExtractImageRegion(ImageType::Pointer imIN, =
ImageType::SizeType=20
regSize,=20
=
<BR> &n=
bsp; &n=
bsp; &n=
bsp; &n=
bsp; =20
ImageType::IndexType <BR>regIndex) <BR>{=20
<P> typedef itk::ExtractImageFilter< ImageType, ImageType =
>=20
FilterType; <BR> FilterType::Pointer filter =3D =
FilterType::New();=20
<BR> ImageType::Pointer imOUT;=20
<P> ImageType::RegionType region; =
<BR> region.SetSize(regSize);=20
<BR> region.SetIndex(regIndex);=20
<P> filter->SetExtractionRegion(region);=20
<BR> filter->SetInput(imIN); <BR> filter->Update(); =
<BR> =20
<BR>// View(filter->GetOutput(), "region"); <-- doing =
this=20
directly shows a distorted image=20
<P>//the following is the extra steps needed to view a correct image=20
<BR>//View, Read, WriteMetaFile are my own functions written using =
itk=20
classes. <BR> imOUT =3D filter->GetOutput();=20
<BR> imOUT->DisconnectPipeline(); <BR> =20
<BR> ImageType::Pointer im; <BR> =20
WriteMetaFile("/home/encephalon/puja/testRegion.mhd", imOUT);=20
<BR> =
im=3DRead("/home/encephalon/puja/testRegion.mhd");=20
<BR> View(im, "region");=20
<P>}=20
<P>Thanks for your help, <BR>Puja <PRE></PRE><PRE>--
---------------------------------------
Puja Malik
Surgical Instruments Group
MEM Research Center for Orthopaedic Surgery
Institute for Surgical Technology and Biomechanics
University of Bern
Murtenstrasse 35, P.O. Box 8354
3010 Bern, Switzerland
Phone: +41-31-632-8730
Fax: +41-31-632-4951
Email: Puja.Malik@MEMcenter.unibe.ch
<A =
href=3D"http://www.MEMcenter.unibe.ch">http://www.MEMcenter.unibe.ch</A>=
---------------------------------------</PRE> =
</BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C2CC74.67843E52--