[Insight-users] Re: Insight-users digest, Vol 1 #188 - 2 msgs
Buu Tien Phan
bphan at mail . uh . edu
Sun, 4 Aug 2002 09:16:16 -0700
Hi Suzanne,
Thank you for you prompt reply. If the problem is about VTK version (I am
using ITK 4.0), so if I take off volume rendering part, then the example
will run just fine. Let me try and see what happens
----- Original Message -----
From: <insight-users-request@public.kitware.com>
To: <insight-users@public.kitware.com>
Sent: Sunday, August 04, 2002 3:39 AM
Subject: Insight-users digest, Vol 1 #188 - 2 msgs
> Send Insight-users mailing list submissions to
> insight-users@public.kitware.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://public.kitware.com/mailman/listinfo/insight-users
> or, via email, send a message with subject or body 'help' to
> insight-users-request@public.kitware.com
>
> You can reach the person managing the list at
> insight-users-admin@public.kitware.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Insight-users digest..."
>
>
> Today's Topics:
>
> 1. Inhomogenity correction using MRIBiasField Correction (cspl)
> 2. Re: TripleTK (Suzanne Vogel)
>
> --__--__--
>
> Message: 1
> From: "cspl" <affable@hd2.dot.net.in>
> To: <insight-users@public.kitware.com>
> Cc: <bhs@pvv.org>
> Date: Sat, 3 Aug 2002 16:49:25 +0530
> Subject: [Insight-users] Inhomogenity correction using MRIBiasField
Correction
>
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_002E_01C23B0D.B9CC1AD0
> Content-Type: text/plain;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Dear Mr.bjorn & Friends,
>
> I am working on itkMRIBiasFieldCorrectionFilter.I got hte problem with =
> array to assign mean and sigma values. I got exception while running at =
> setting parameters like as follows.
>
> Volume* CIPServerDoc::Inhomogenity(Volume *vol,Volume *mask)
> {
> if (vol =3D=3D NULL) return vol;
> short *Buffer =3D new short[vol->width * vol->height * vol->depth];
> short *Buffer1 =3D new short[mask->width * mask->height * =
> mask->depth];
> =20
> Buffer =3D (short *) vol->Mem;
> Buffer1=3D (short *) mask->Mem;=20
> =20
> typedef itk::Image<float,3> ImageType;
> typedef itk::Image<float,3> ImageType1;
> typedef itk::Image<float,3> ImageType2;
>
> itk::RawImageIO<float, 3>::Pointer output_io
> =3D itk::RawImageIO<float, 3>::New();
> =20
> output_io->SetByteOrderToLittleEndian();
> output_io->SetFileTypeToBinary();
> output_io->SetFileDimensionality(3);
>
> // Initialize the initial and target volumes.
> ImageType::Pointer vol_init =3D ImageType::New();
> ImageType1::Pointer vol_init1 =3D ImageType1::New();
> ImageType2::Pointer vol_init2 =3D ImageType2::New();
> =20
> =20
> ImageType::SizeType sz;
> sz[0] =3D vol->width;
> sz[1] =3D vol->height;
> sz[2]=3Dvol->depth;=20
>
> ImageType1::SizeType sz1;
> sz1[0] =3D mask->width;
> sz1[1] =3D mask->height;
> sz1[2]=3D mask->depth;=20
>
> =20
> ImageType::IndexType idx;
> idx[0] =3D 0;
> idx[1] =3D 0;
> idx[2] =3D 0 ;
>
> ImageType1::IndexType idx1;
> idx1[0] =3D 0;
> idx1[1] =3D 0;
> idx1[2] =3D 0 ;
> =20
> ImageType::RegionType reg; =20
> reg.SetSize(sz);
> reg.SetIndex(idx);
>
> ImageType1::RegionType reg1; =20
> reg.SetSize(sz1);
> reg.SetIndex(idx1);
> =20
> vol_init->SetRegions(reg);
> vol_init1->SetRegions(reg1);
> vol_init2->SetRegions(reg);
> vol_init->Allocate();
> vol_init1->Allocate();
> vol_init2->Allocate();
>
>
> =20
> for(int z=3D0; z<vol->depth; ++z )
> {=20
> idx[2]=3Dz;
> =20
> for (int y =3D 0; y < vol->height; ++y)
> {
> idx[1] =3D y;
> for (int x =3D 0; x < vol->width; ++x)
> {
> idx[0] =3D x;
> vol_init->SetPixel(idx, *(Buffer +(z*vol->height*vol->width)+y =
> *vol->width +x));
> }
> }
> =20
> }
> =20
> =20
> ////mask
> for(int z1=3D0; z1<mask->depth; ++z1 )
> {=20
> idx1[2]=3Dz1;
> for (int y1 =3D 0; y1<mask->height; ++y1)
> {
> idx1[1] =3D y1;
> file://AfxMessageBox("in mask height loop");
> for (int x1=3D0; x1 < mask->width; ++x1)
> {
> idx1[0] =3D x1;
> vol_init2->SetPixel(idx1,*(Buffer1 =
> +(z1*mask->height*mask->width)+y1 *mask->width +x1));
> }
> =20
> }
> =20
> }
> =20
> typedef BiasFieldCorrectionFilter<ImageType,ImageType,ImageType1>=20
> Corrector;
> Corrector::Pointer filter =3D Corrector::New() ;
> file://parameters initiliazation
> bool useLog =3D true;
> int degree =3D 3;
> int sliceDirection =3D 2;
> =20
>
> vnl_vector<double> coefficientVector ;
> itk::Array<double> *classMeans =3D new itk::Array<double>;
> =20
> classMeans[0]=3D1500;
> classMeans[1]=3D570;
>
> itk::Array<double> *classSigmas=3D new itk::Array<double> ;
> classSigmas[0]=3D100;
> classSigmas[1]=3D70;
>
> int volumeMaximumIteration =3D 2000;=20
> int interSliceMaximumIteration =3D 20;=20
> // double initialRadius ;
> double growth =3D 1.05;
> double shrink =3D 0.0;
> AfxMessageBox("before set input");
> filter->SetInput(vol_init);
> filter->SetInputMask(vol_init2);
>
>
> filter->IsBiasFieldMultiplicative(useLog) ;
> ///////////////////////////////////////////////////////////////////////
> filter->SetTissueClassStatistics(*classMeans,*classSigmas) ;/// /* here =
> Getting exception */
> //////////////////////////////////////////////////////////////////////
>
> filter->SetOptimizerGrowthFactor(growth) ;
>
> filter->SetOptimizerShrinkFactor(shrink) ;
>
> filter->SetVolumeCorrectionMaximumIteration(volumeMaximumIteration) ;
> =20
> =
>
file://filter->SetInterSliceCorrectionMaximumIteration(interSliceMaximumIter
at=
> ion) ;
> file://filter->SetOptimizerInitialRadius(initialRadius) ;
> filter->SetBiasFieldDegree(degree) ;
> =20
> // filter->SetUsingSlabIdentification(usingSlabIdentification) ;
> filter->SetSlicingDirection(sliceDirection) ;
> =20
> =20
> AfxMessageBox("before update");
> filter->Update();
> =20
> vol_init2=3Dfilter->GetOutput();
> =20
> for(unsigned int z=3D0; z<vol->depth; ++z )
> {
> idx[2]=3Dz;
> =20
> for (unsigned int y =3D 0; y < vol->height; ++y)
> {
> idx[1] =3D y;
> for (unsigned int x =3D 0; x < vol->width; ++x)
> {
> idx[0] =3D x;
> *(Buffer +(z*vol->height*vol->width)+y *vol->width =
> +x)=3Dvol_init->GetPixel(idx);
> }
> }
> }
>
> vol->Mem =3D Buffer;
> return vol;
>
> }
>
>
> Why I am getting exception when call =
> filter->SetTissueClassStatistics(*classMeans,*classSigmas) .
>
> Please give me suggestion.
>
> Thanking you,
> Regards,
> Ramakrishna
>
> ------=_NextPart_000_002E_01C23B0D.B9CC1AD0
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; =
> charset=3Diso-8859-1">
> <META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=3D#ffffff>
> <DIV><FONT face=3DArial size=3D2>Dear Mr.bjorn & =
> Friends,</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2>I am working on =
> itkMRIBiasFieldCorrectionFilter.I=20
> got hte problem with array to assign mean and sigma values. I got =
> exception=20
> while running at setting parameters like as follows.</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2>Volume* =
> CIPServerDoc::Inhomogenity(Volume=20
> *vol,Volume *mask)<BR>{<BR> if (vol =3D=3D NULL) return =
> vol;<BR> short=20
> *Buffer =3D new short[vol->width * vol->height *=20
> vol->depth];<BR> short *Buffer1 =3D new =
> short[mask->width *=20
> mask->height * mask->depth];<BR> <BR> Buffer =3D =
> (short *)=20
> vol->Mem;<BR> Buffer1=3D (short *) mask->Mem;=20
> <BR> <BR> typedef itk::Image<float,3>=20
> ImageType;<BR> typedef itk::Image<float,3>=20
> ImageType1;<BR> typedef itk::Image<float,3> =
> ImageType2;</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2> itk::RawImageIO<float, =
> 3>::Pointer=20
> output_io<BR> =3D =
> itk::RawImageIO<float,=20
> 3>::New();<BR> <BR> =20
> output_io->SetByteOrderToLittleEndian();<BR> =20
> output_io->SetFileTypeToBinary();<BR> =20
> output_io->SetFileDimensionality(3);</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2> // Initialize =
> the initial=20
> and target volumes.<BR> =20
> ImageType::Pointer vol_init =3D =
> ImageType::New();<BR> ImageType1::Pointer=20
> vol_init1 =3D ImageType1::New();<BR> ImageType2::Pointer vol_init2 =
> =3D=20
> ImageType2::New();<BR> <BR> =
> <BR> =20
> ImageType::SizeType sz;<BR> sz[0] =3D=20
> vol->width;<BR> sz[1] =3D=20
> vol->height;<BR> sz[2]=3Dvol->depth; </FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2> ImageType1::SizeType =
> sz1;<BR> sz1[0] =3D=20
> mask->width;<BR> sz1[1] =3D =
> mask->height;<BR> sz1[2]=3D =20
> mask->depth; </FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2> =
> <BR> ImageType::IndexType=20
> idx;<BR> idx[0] =3D 0;<BR> idx[1] =3D 0;<BR> idx[2] =3D 0 =
>
> ;</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2> ImageType1::IndexType=20
> idx1;<BR> idx1[0] =3D=20
> 0;<BR> idx1[1] =3D =
> 0;<BR> idx1[2] =3D=20
> 0 ;<BR> <BR> =
>
> ImageType::RegionType reg; =
> <BR> =20
> reg.SetSize(sz);<BR> =20
> reg.SetIndex(idx);</FONT></DIV>
> <DIV> </DIV>
> <DIV><FONT face=3DArial size=3D2> ImageType1::RegionType =
> reg1; =20
> <BR> =20
> reg.SetSize(sz1);<BR> =20
> reg.SetIndex(idx1);<BR> =20
> <BR> =20
> vol_init->SetRegions(reg);<BR> vol_init1->SetRegions(reg1);<BR=
> > vol_init2->SetRegions(reg);<BR> &n=
> bsp; =20
> vol_init->Allocate();<BR> vol_init1->Allocate();<BR> vol_=
> init2->Allocate();</FONT></DIV>
> <DIV> </DIV><FONT face=3DArial size=3D2>
> <DIV><BR> <BR> for(int z=3D0; z<vol->depth; ++z =
> )<BR> {=20
> <BR> idx[2]=3Dz;<BR> <BR> &n=
> bsp; =20
> for (int y =3D 0; y < vol->height;=20
> ++y)<BR> =20
> {<BR> idx[1] =
> =3D=20
> y;<BR> for =
> (int x =3D=20
> 0; x < vol->width;=20
> ++x)<BR>  =
> ;=20
> {<BR> &n=
> bsp; =20
> idx[0] =3D x;<BR> =
> vol_init->SetPixel(idx,=20
> *(Buffer +(z*vol->height*vol->width)+y *vol->width=20
> +x));<BR> =20
> }<BR> }<BR> =20
> <BR> }<BR> <BR> <BR> ////mask<BR> for(int =
> z1=3D0;=20
> z1<mask->depth; ++z1 )<BR> { <BR> =20
> idx1[2]=3Dz1;<BR> for (int y1 =3D 0; =
> y1<mask->height;=20
> ++y1)<BR> =20
> {<BR> idx1[1] =3D=20
> y1;<BR> file://AfxMessageBox("in mask height=20
> loop");<BR> for =
> (int=20
> x1=3D0; x1 < mask->width;=20
> ++x1)<BR> &nbs=
> p;=20
> {<BR> &n=
> bsp; =20
> idx1[0] =3D x1;<BR> =20
> vol_init2->SetPixel(idx1,*(Buffer1=20
> +(z1*mask->height*mask->width)+y1 *mask->width=20
> +x1));<BR> }<BR> =20
> <BR> }<BR> =20
> <BR> }<BR> <BR>typedef=20
> BiasFieldCorrectionFilter<ImageType,ImageType,ImageType1>=20
> <BR> Corrector;<BR> Corrector::Pointer filter =3D =
> Corrector::New()=20
> ;<BR>//parameters initiliazation<BR> bool useLog =3D =
> true;<BR> int=20
> degree =3D 3;<BR> int sliceDirection =3D 2;<BR> </DIV>
> <DIV> </DIV>
> <DIV> vnl_vector<double> coefficientVector ;<BR> =20
> itk::Array<double> *classMeans =3D new =
> itk::Array<double>;<BR> =20
> <BR> classMeans[0]=3D1500;<BR> classMeans[1]=3D570;</DIV>
> <DIV> </DIV>
> <DIV> itk::Array<double> *classSigmas=3D new =
> itk::Array<double>=20
> ;<BR> classSigmas[0]=3D100;<BR> classSigmas[1]=3D70;</DIV>
> <DIV> </DIV>
> <DIV> int volumeMaximumIteration =3D 2000; <BR> int=20
> interSliceMaximumIteration =3D 20; <BR>// double initialRadius=20
> ;<BR> double growth =3D 1.05;<BR> double shrink =3D=20
> 0.0;<BR> AfxMessageBox("before set=20
> input");<BR> filter->SetInput(vol_init);<BR> filter->SetI=
> nputMask(vol_init2);</DIV>
> <DIV> </DIV>
> <DIV><BR> filter->IsBiasFieldMultiplicative(useLog)=20
> ;<BR>////////////////////////////////////////////////////////////////////=
> ///<BR> filter->SetTissueClassStatistics(*classMeans,*classSigmas=
> )=20
> ;/// /* here Getting exception =20
> */<BR>///////////////////////////////////////////////////////////////////=
> ///</DIV>
> <DIV> </DIV>
> <DIV> filter->SetOptimizerGrowthFactor(growth) ;</DIV>
> <DIV> </DIV>
> <DIV> filter->SetOptimizerShrinkFactor(shrink) ;</DIV>
> <DIV> </DIV>
> <DIV> filter->SetVolumeCorrectionMaximumIteration(volumeMaximumIt=
> eration)=20
> ;<BR> <BR> //filter->SetInterSliceCorrectionMaximumIteration=
> (interSliceMaximumIteration)=20
> ;<BR> //filter->SetOptimizerInitialRadius(initialRadius)=20
> ;<BR> filter->SetBiasFieldDegree(degree)=20
> ;<BR> <BR>// filter->SetUsingSlabIdentification(usingSlabIde=
> ntification)=20
> ;<BR> filter->SetSlicingDirection(sliceDirection) =
> ;<BR> <BR> =20
> <BR> AfxMessageBox("before=20
> update");<BR> filter->Update();<BR> <BR> vol_init2=3Dfi=
> lter->GetOutput();<BR> <BR> for(unsigned=20
> int z=3D0; z<vol->depth; ++z=20
> )<BR> {<BR> idx[2]=3Dz;<BR> <BR> &n=
> bsp; =20
> for (unsigned int y =3D 0; y < vol->height;=20
> ++y)<BR> =20
> {<BR> idx[1] =3D=20
> y;<BR> for =
> (unsigned int x=20
> =3D 0; x < vol->width;=20
> ++x)<BR>  =
> ;=20
> {<BR> &n=
> bsp; =20
> idx[0] =3D=20
> x;<BR> &=
> nbsp; =20
> *(Buffer +(z*vol->height*vol->width)+y *vol->width=20
> +x)=3Dvol_init->GetPixel(idx);<BR> =
> =20
> }<BR> }<BR> }</DIV>
> <DIV> </DIV>
> <DIV> vol->Mem =3D =
> Buffer;<BR> =20
> return vol;</DIV>
> <DIV> </DIV>
> <DIV>}</DIV>
> <DIV> </DIV>
> <DIV><BR>Why I am getting exception when call =20
> filter->SetTissueClassStatistics(*classMeans,*classSigmas) .</DIV>
> <DIV> </DIV>
> <DIV>Please give me suggestion.</DIV>
> <DIV> </DIV>
> <DIV>Thanking you,<BR>Regards,<BR>Ramakrishna</FONT></DIV></BODY></HTML>
>
> ------=_NextPart_000_002E_01C23B0D.B9CC1AD0--
>
>
> --__--__--
>
> Message: 2
> Date: Sat, 03 Aug 2002 07:48:40 -0400
> From: Suzanne Vogel <vogel@cs.unc.edu>
> To: insight-users@public.kitware.com
> Cc: Active members of the CADDLab <caddlab-internal@listserv.unc.edu>
> Subject: [Insight-users] Re: TripleTK
>
> Buu,
>
> I believe TripleTKImageDisplay requires a pre-4.0 version of VTK,
> whereas the other classes of ITK work fine with 4.0 VTK. If I recall
> correctly, our research group was unable to compile TripleTKImageDisplay
> using 4.0 VTK. (I'm CC:ing my research group in case I'm wrong.)
>
> Good luck,
> Suzanne
>
>
>
> --__--__--
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>
>
> End of Insight-users Digest