[Insight-users] RE: Problem with HistogramType::ConstIterator inside function
Radhika Sivaramakrishna
radhika.sivaramakrishna at synarc.com
Wed, 11 Feb 2004 12:15:24 -0800
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_01C3F0DB.C831BBF4
Content-Type: text/plain
Hi Luis,
That was very sweet :-)
The error is very non-illuminating that is why I said that.
Here it is.
/export/jfs/rsivaram/PostExbrain-code/HistogramThreshold.txx:94: parse error
before `=' token
/export/jfs/rsivaram/PostExbrain-code/HistogramThreshold.txx:95: parse error
before `=' token
The lines for which it is complaining are:
HistogramType::ConstIterator itr = histogram->Begin();
HistogramType::ConstIterator end = histogram->End();
Radhika
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Wednesday, February 11, 2004 12:13 PM
To: Radhika Sivaramakrishna
Cc: 'Miller, James V (Research)'; 'ITK'
Subject: Re: Problem with HistogramType::ConstIterator inside function
Hi Radhika,
It will be an extremely generous act on your part
to share the text of the error message with us.
Our divinatory skill are *very very* limited... :-/
Please post the compiler error message that you get.
Thanks
Luis
-------------------------------
Radhika Sivaramakrishna wrote:
>
> Hi Luis and Jim,
>
> I was trying to use the ScalarImageToHistogramGenerator inside a
> function to which I pass an image and mask. I am running into some
problems.
>
> My function is templated and is defined like this:
>
> template <class PixelType>
> void HistogramThreshold(const itk::Image< PixelType, 3> * image,
> itk::Image< PixelType, 3> * mask)
>
> The code where I get the error is very similar to one of the histogram
> examples and is like this:
>
> typedef itk::Statistics::ScalarImageToHistogramGenerator<
> ImageType
> >
> HistogramGeneratorType;
>
> HistogramGeneratorType::Pointer histogramGenerator =
> HistogramGeneratorType::New();
>
> histogramGenerator->SetInput( image );
>
> histogramGenerator->SetNumberOfBins( NumberOfBins );
> histogramGenerator->SetMarginalScale( MarginalScale );
> histogramGenerator->Compute();
>
> typedef HistogramGeneratorType::HistogramType HistogramType;
>
> const HistogramType * histogram = histogramGenerator->GetOutput();
>
> const unsigned int histogramSize = histogram->Size();
>
> std::cout << "Histogram size " << histogramSize << std::endl;
>
> HistogramType::ConstIterator itr = histogram->Begin();
> HistogramType::ConstIterator end = histogram->End();
>
> The compile error I am getting is hardly descriptive. It says that there
> is a parse error in this definition of itr and end (see above). I do not
> get this error when this whole thing is one main function.
>
> My suspicion is it has something to do with typename etc. Can you tell
> me exactly how to define the two Histogram iterators without getting
> this error?
>
> Thanks
> Radhika
>
>
> -----------------------------------------------------
> Confidentiality Notice.
> This email message is for the sole use of the intended recipient(s) and
> may contain confidential and privileged information. Any unauthorized
> review, use, disclosure or distribution is prohibited. If you are not
> the intended recipient, please contact the sender by reply email and
> destroy all copies of the original message. If you are the intended
> recipient, please be advised that the content of this message is subject
> to access, review and disclosure by the sender's Email System
Administrator.
>
-----------------------------------------------------
Confidentiality Notice.
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. If you are the intended recipient, please be
advised that the content of this message is subject to access, review and
disclosure by the sender's Email System Administrator.
------_=_NextPart_001_01C3F0DB.C831BBF4
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2656.87">
<TITLE>RE: Problem with HistogramType::ConstIterator inside =
function</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>Hi Luis,</FONT>
<BR><FONT SIZE=3D2>That was very sweet :-) </FONT>
<BR><FONT SIZE=3D2>The error is very non-illuminating that is why I =
said that.</FONT>
<BR><FONT SIZE=3D2>Here it is.</FONT>
</P>
<P><FONT =
SIZE=3D2>/export/jfs/rsivaram/PostExbrain-code/HistogramThreshold.txx:94=
: parse error</FONT>
<BR><FONT SIZE=3D2> before `=3D' token</FONT>
<BR><FONT =
SIZE=3D2>/export/jfs/rsivaram/PostExbrain-code/HistogramThreshold.txx:95=
: parse error</FONT>
<BR><FONT SIZE=3D2> before `=3D' token</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>The lines for which it is complaining are:</FONT>
</P>
<P><FONT SIZE=3D2>HistogramType::ConstIterator itr =3D =
histogram->Begin();</FONT>
<BR><FONT SIZE=3D2>HistogramType::ConstIterator end =3D =
histogram->End();</FONT>
</P>
<P><FONT SIZE=3D2>Radhika</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Luis Ibanez [<A =
HREF=3D"mailto:luis.ibanez at kitware.com">mailto:luis.ibanez at kitware.com</=
A>] </FONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, February 11, 2004 12:13 PM</FONT>
<BR><FONT SIZE=3D2>To: Radhika Sivaramakrishna</FONT>
<BR><FONT SIZE=3D2>Cc: 'Miller, James V (Research)'; 'ITK'</FONT>
<BR><FONT SIZE=3D2>Subject: Re: Problem with =
HistogramType::ConstIterator inside function</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Hi Radhika,</FONT>
</P>
<P><FONT SIZE=3D2>It will be an extremely generous act on your =
part</FONT>
<BR><FONT SIZE=3D2>to share the text of the error message with =
us.</FONT>
</P>
<P><FONT SIZE=3D2>Our divinatory skill are *very very* limited... =
:-/</FONT>
</P>
<P><FONT SIZE=3D2>Please post the compiler error message that you =
get.</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>Thanks</FONT>
</P>
<BR>
<P><FONT SIZE=3D2> Luis</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>-------------------------------</FONT>
<BR><FONT SIZE=3D2>Radhika Sivaramakrishna wrote:</FONT>
</P>
<P><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Hi Luis and Jim,</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I was trying to use the =
ScalarImageToHistogramGenerator inside a </FONT>
<BR><FONT SIZE=3D2>> function to which I pass an image and mask. I =
am running into some problems.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> My function is templated and is defined like =
this:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> template <class PixelType></FONT>
<BR><FONT SIZE=3D2>> void HistogramThreshold(const itk::Image< =
PixelType, 3> * image,</FONT>
<BR><FONT =
SIZE=3D2>>  =
; itk::Image< PixelType, 3> * mask)</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> The code where I get the error is very similar =
to one of the histogram </FONT>
<BR><FONT SIZE=3D2>> examples and is like this:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> typedef =
itk::Statistics::ScalarImageToHistogramGenerator<</FONT>
<BR><FONT =
SIZE=3D2>>  =
;  =
;  =
;  =
; ImageType</FONT>
<BR><FONT =
SIZE=3D2>>  =
;  =
;  =
;  =
;  =
; > </FONT>
<BR><FONT SIZE=3D2>> HistogramGeneratorType;</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> HistogramGeneratorType::Pointer =
histogramGenerator =3D </FONT>
<BR><FONT SIZE=3D2>> HistogramGeneratorType::New();</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> histogramGenerator->SetInput( image =
);</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> =
histogramGenerator->SetNumberOfBins( NumberOfBins );</FONT>
<BR><FONT SIZE=3D2>> =
histogramGenerator->SetMarginalScale( MarginalScale );</FONT>
<BR><FONT SIZE=3D2>> =
histogramGenerator->Compute();</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> typedef =
HistogramGeneratorType::HistogramType HistogramType;</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> const HistogramType * histogram =3D =
histogramGenerator->GetOutput();</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> const unsigned int histogramSize =
=3D histogram->Size();</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> std::cout << "Histogram =
size " << histogramSize << std::endl;</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> HistogramType::ConstIterator itr =
=3D histogram->Begin();</FONT>
<BR><FONT SIZE=3D2>> HistogramType::ConstIterator end =
=3D histogram->End();</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> The compile error I am getting is hardly =
descriptive. It says that there </FONT>
<BR><FONT SIZE=3D2>> is a parse error in this definition of itr and =
end (see above). I do not </FONT>
<BR><FONT SIZE=3D2>> get this error when this whole thing is one =
main function.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> My suspicion is it has something to do with =
typename etc. Can you tell </FONT>
<BR><FONT SIZE=3D2>> me exactly how to define the two Histogram =
iterators without getting </FONT>
<BR><FONT SIZE=3D2>> this error?</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Thanks</FONT>
<BR><FONT SIZE=3D2>> Radhika</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT =
SIZE=3D2>>  =
;  =
;  =
;  =
; </FONT>
<BR><FONT SIZE=3D2>> =
----------------------------------------------------- </FONT>
<BR><FONT SIZE=3D2>> Confidentiality Notice.</FONT>
<BR><FONT SIZE=3D2>> This email message is for the sole use of the =
intended recipient(s) and </FONT>
<BR><FONT SIZE=3D2>> may contain confidential and privileged =
information. Any unauthorized </FONT>
<BR><FONT SIZE=3D2>> review, use, disclosure or distribution is =
prohibited. If you are not </FONT>
<BR><FONT SIZE=3D2>> the intended recipient, please contact the =
sender by reply email and </FONT>
<BR><FONT SIZE=3D2>> destroy all copies of the original message. If =
you are the intended </FONT>
<BR><FONT SIZE=3D2>> recipient, please be advised that the content =
of this message is subject </FONT>
<BR><FONT SIZE=3D2>> to access, review and disclosure by the =
sender's Email System Administrator.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
</P>
<BR>
<P><FONT =
SIZE=3D2> &nb=
sp; &nb=
sp; &nb=
sp; &nb=
sp; </FONT>
<BR><FONT =
SIZE=3D2>----------------------------------------------------- =
</FONT>
<BR><FONT SIZE=3D2>Confidentiality Notice. </FONT>
<BR><FONT SIZE=3D2>This email message is for the sole use of the =
intended recipient(s) and may contain confidential and privileged =
information. Any unauthorized review, use, disclosure or distribution =
is prohibited. If you are not the intended recipient, please contact =
the sender by reply email and destroy all copies of the original =
message. If you are the intended recipient, please be advised that the =
content of this message is subject to access, review and disclosure by =
the sender's Email System Administrator.</FONT></P>
</BODY>
</HTML>
------_=_NextPart_001_01C3F0DB.C831BBF4--