<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16414" name=GENERATOR>
<STYLE>
<!--
/* Font Definitions */
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Verdana;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
/* Page Definitions */
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Verdana color=#000000 size=2>Dear Mr Luis Ibanez:</FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana size=2> What I
mean is that: </FONT></DIV>
<DIV><FONT size=2> <FONT
face=Verdana> I can build the project in both Debug
mode and Release mode successfully. And the release version
could be run correctly.</FONT></FONT></DIV>
<DIV><FONT face=Verdana
size=2> But in the Debug
mode, whatever I use F5 or F10, etc in the debug tool, the windows
system will throw the error with a Error Dilaogue including: (at
<STRONG>itk::ImageFileReader</STRONG> [reader]->Update(); )</FONT></DIV>
<DIV><FONT face=Verdana size=2>
</FONT></DIV>
<DIV><FONT face=Verdana
size=2> "Debug
Assertion Failed!<BR>
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)</FONT></DIV>
<DIV><FONT face=Verdana
size=2> "</FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana
size=2> And the call
stack of the debugger in VS2003 shows that:</FONT></DIV>
<DIV><FONT face=Verdana
size=2> </FONT></DIV>
<DIV><FONT face=Verdana size=2>
itk::ImageIOFactory::CreateImageIO(const char * path=0x0139d870,
itk::ImageIOFactory::FileModeType mode=ReadMode) Line75 + 0x57
<BR>
> if((*k)->CanReadFile(path))<BR>
>
{<BR>
> return
*k;<BR> >
}<BR> </FONT></DIV>
<DIV><FONT face=Verdana size=2>
itk::ImageFileReader<itk::Image<unsigned
short,2>,itk::DefaultConvertPixelTraits<unsigned short>
>::GenerateOutputInformation() Line109 + 0x27
<BR>
ITKCommon.dll!itk::ProcessObject::UpdateOutputInformation() Line760</FONT></DIV>
<DIV><FONT face=Verdana> <FONT size=2>
itk::ImageBase<2>::UpdateOutputInformation() Line177 +
0x3e</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Verdana>
ITKCommon.dll!itk::DataObject::Update() Line343</FONT> </FONT></DIV>
<DIV> </DIV>
<DIV>--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</DIV>
<DIV>Here is the code what I use:</DIV>
<DIV> </DIV>
<DIV>typedef itk::Image<unsigned
short,3> InputImageType;<BR>typedef
itk::ImageFileReader< InputImageType >
FixedImageReaderType;<BR>FixedImageReaderType::Pointer reader;<BR>reader
= FixedImageReaderType::New();<BR> </DIV>
<DIV>reader->SetFileName( filename );</DIV>
<DIV> </DIV>
<DIV> try<BR> {<BR>
reader->Update(); <STRONG><- HERE:
Error occurs ( why does it only occur under the DEBUG
mode, however, Release mode is okay?
)</STRONG><BR> }<BR> catch(itk::ExceptionObject & err
)<BR> {<BR> std::cout<< "ExceptionObject caught !"
<< std::endl;<BR> std::cout<< err <<
std::endl;<BR> std::cout<< "while reading fixed
image"<<std::endl;<BR> }<BR>
</DIV>
<DIV><STRONG><FONT color=#ff0000>*BUT*</FONT></STRONG></DIV>
<DIV><STRONG><FONT color=#000000>If I add three statements in the above code
block. The error <FONT color=#ff0000>disappeared</FONT>.
Like:</FONT></STRONG></DIV>
<DIV> </DIV>
<DIV>
<DIV>typedef itk::Image<unsigned
short,3> InputImageType;<BR>typedef
itk::ImageFileReader< InputImageType >
FixedImageReaderType;<BR>FixedImageReaderType::Pointer reader;<BR>reader
= FixedImageReaderType::New();<BR> </DIV>
<DIV>reader->SetFileName( filename );</DIV>
<DIV> </DIV>
<DIV><STRONG>itk::ImageIOBase::Pointer pio;<BR>pio =
itk::MetaImageIO::New();<BR>reader->SetImageIO( pio );</STRONG><BR></DIV>
<DIV> try<BR> {<BR>
reader->Update(); <STRONG><- NO error
HERE</STRONG></DIV>
<DIV> }<BR> catch(itk::ExceptionObject & err
)<BR> {<BR> std::cout<< "ExceptionObject caught !"
<< std::endl;<BR> std::cout<< err <<
std::endl;<BR> std::cout<< "while reading fixed
image"<<std::endl;<BR> }</DIV>
<DIV> </DIV>
<DIV>Could you tell me the reason of that? </DIV>
<DIV> </DIV>
<DIV><BR>Thank you very much indeed.</DIV></DIV>
<DIV><FONT face=Verdana size=2> </FONT></DIV>
<DIV align=left>
<DIV align=left><FONT face=Verdana size=2>
<HR style="WIDTH: 122px; HEIGHT: 2px" SIZE=2>
</FONT></DIV>
<DIV><FONT color=#c0c0c0><FONT face=Verdana size=2>jimmy</FONT></DIV>
<DIV><FONT face=Verdana size=2>2007-07-26</FONT></FONT></DIV></DIV>
<DIV><FONT face=Verdana size=2>
<HR>
</FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发件人:</STRONG> Luis
Ibanez</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>发送时间:</STRONG>
2007-07-25 20:40:25</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>收件人:</STRONG>
jimmy</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>抄送:</STRONG>
insight-users</FONT></FONT></DIV>
<DIV><FONT face=Verdana><FONT size=2><STRONG>主题:</STRONG> Re: Re:
[Insight-users] Cannot debug projects of ITKApplication.</FONT></FONT></DIV>
<DIV><FONT face=Verdana size=2></FONT> </DIV>
<DIV><FONT face=Verdana size=2><BR>Hi Jimmy,<BR><BR><BR>Can you please do the
following:<BR><BR><BR>1) In your binary version of ITK, run CMake again and
Enable
<BR><BR>
BUILD_TESTING<BR>
BUILD_EXAMPLES<BR><BR><BR>2) Go to advanced mode (by selecting the check box on
the top right)<BR> and search down for the "SITE" variable.
Make sure that it has the<BR> correct name of your
computer.<BR><BR><BR>3) Click on the Configure button and then in the OK button.
<BR><BR><BR>4) Build ITK again, this time it will compile the 1,200
programs<BR> of the testing suit. Make sure that you do this
build for the<BR> "Debug" compilation mode. The build could take 1
to 3<BR> hours depending on the speed of your machine.
<BR><BR><BR>5) Once the build finishes, open a console window (MS_DOS or
Cygwin)<BR> and run the "ctest" command with the option -D
Experimental<BR>
<DIV><SPAN class=gmail_quote><BR> in most machines this will
look like: <BR><BR> C:\Program File\CMake
2.4\bin\ctest -D Experimental -C Debug<BR><BR><BR>
Make sure that you add the "-C Debug" at the end, so the testing<BR>
will be executed for the Debug compilation mode.<BR><BR> This will
trigger the execution of the testing framework and will send<BR> the
results to the public ITK Dashboard.<BR><BR><BR>6) When the submission is
complete, please let us know, so we<BR> can take a look at the
results of your submission in the Dashboard. <BR><BR><BR>This will let us know
if you build is working correctly on Debug mode.<BR><BR><BR>BTW: When you say
that you
<BR></SPAN><BR>
"cannot DEBUG in *ITKApplication*"<BR><SPAN class=gmail_quote><BR>Do you mean
that:<BR><BR> 1) you can't build in Debug mode an ITK application of your
own ?<BR></SPAN><SPAN class=gmail_quote><BR> 2) you can't build in Debug
mode InsightApplications ?<BR><BR> 3) you can build in Debug, but then
when using F5, the applications <BR> does not start
?<BR><BR> 4) Do you get any error messages ?<BR> If
so, please post to the list the *EXACT* error message that you are
getting. </SPAN><BR><SPAN class=gmail_quote><BR><BR><BR>We will appreciate
a more detailed and precise description of your problem. <BR><BR><BR>When you
send emails to the mailing list, you should describe your<BR>problem as a list
of step by step instructions that will allow another <BR>person to
replicate the problem that you are
encountering.<BR><BR><BR><BR>
Thanks<BR><BR><BR>
Luis<BR><BR><BR>-----------------------------------------------------------------------------<BR>On
7/23/07, <B class=gmail_sendername>jimmy</B> <<A
href="mailto:jimmy_lab@163.com"> jimmy_lab@163.com</A>> wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Hi,
Luis:<BR><BR> Thank you for
your suggestion. <BR> I am
sorry that I have not describe my problem
clearly.<BR> I have already
generate the MetaImage head (.mhd)
beforehand.<BR> And I used
ImageFileReader correctly and access the data successfully by my own codes.(
It also could be debugged )
<BR><BR> However what confused
me is that I cannot DEBUG in *ITKApplication* as I mentioned before, but the
RLEASE mode is okay.<BR> Could
you give me any other suggestion?<BR><BR>Thank you very much indeed.
<BR><BR>Sincerely,<BR>Jimmy<BR><BR>------------------<BR>jimmy<BR>2007-07-23<BR><BR>-------------------------------------------------------------<BR>发件人:Luis
Ibanez<BR>发送日期:2007-07-23 21:35:51<BR>收件人:jimmy<BR>抄送:insight-users <BR>主题:Re:
[Insight-users] Cannot debug projects of ITKApplication.<BR><BR><BR>Hi
Jimmy,<BR><BR>You should have mentioned from the beginning that you<BR>were
attempting to read a RAW image
file.<BR><BR><BR> You *CANNOT*
read a RAW image file
<BR> directly with the
ImageFileReader.<BR><BR><BR><BR>You have the following
options:<BR><BR> a) Create a MetaImage header for the RAW
file.<BR> b) Use explicitly the RAWImageIO class in your
code.<BR><BR><BR>From these two options, method (a) is the recommended one
<BR>because method (b) results in hard-coding the image<BR>parameters in your
program.<BR><BR><BR>The easiest way of creating a MetaImage header for
your<BR>raw image is to use the program:<BR><BR><BR>
InsightApplications/MetaImageImporter <BR><BR><BR>It is a command-line dialog
that will guide you through<BR>the process by asking you questions about your
image.<BR><BR><BR>The filename extension of your MetaImage header must
be<BR>".mhd".<BR><BR>Once you have created this header, you can pass it as
<BR>the filename to be read by the ImageFileReader.<BR><BR><BR>
Regards,<BR><BR><BR> Luis<BR><BR><BR>============================<BR>jimmy
wrote:<BR>> Here is an example of this problem:<BR>><BR>> I use
itk::ImageFileReader [reader] to read a Raw data. After the file
name is set, and it runs to <BR>>
[reader]->Update(); Error occurs.<BR>><BR>>
The following is call stack of
Debugger:<BR>><BR>>
itk::ImageIOFactory::CreateImageIO(const char * path=0x0139d870,
itk::ImageIOFactory::FileModeType mode=ReadMode) Line75 + 0x57
<BR>>
if((*k)->CanReadFile(path))<BR>>
{<BR>> return
*k;<BR>>
}<BR>><BR>>
itk::ImageFileReader<itk::Image<unsigned
short,2>,itk::DefaultConvertPixelTraits<unsigned short>
>::GenerateOutputInformation() Line109 + 0x27
<BR>>
ITKCommon.dll!itk::ProcessObject::UpdateOutputInformation() Line760<BR>>
itk::ImageBase<2>::UpdateOutputInformation() Line177 +
0x3e<BR>>
ITKCommon.dll!itk::DataObject::Update() Line343
<BR>><BR>><BR>> Thanks in advance.<BR>> ------------------<BR>>
jimmy<BR>> 2007-07-23<BR>><BR>>
-------------------------------------------------------------<BR>> 发件人:Luis
Ibanez<BR>> 发送日期:2007-07-22 22:57:00 <BR>> 收件人:jimmy<BR>>
抄送:insight-users<BR>> 主题:Re: [Insight-users] Cannot debug projects of
ITKApplication.<BR>><BR>> Hi Jimmy,<BR>><BR>> Can you look at the
call stack in the debugger ?<BR>><BR>> Could you trace what is the ITK
file, and line <BR>> that is triggering the error ?<BR>><BR>> Please
let us know,<BR>><BR>><BR>>
Thanks<BR>><BR>><BR>>
Luis<BR>><BR>><BR>> ----------------<BR>> jimmy
wrote:<BR>><BR>>>Hi, everyone. <BR>>><BR>>>I have met a
very strange problem when using ITKApplication:<BR>>>I cannot debug or
run Applications (e.g. ImageRegistration2D ,IntensityBased2D3DRegistration )
under the DEBUG mode in VS 2003. <BR>>>Here is the Error
message:<BR>>>"<BR>>>Debug Assertion
Failed!<BR>>>Expression:
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)<BR>>>"<BR>>>at
[m_FixedImageReader or other object]->Update(); <BR>>><BR>>>On
the contrary, the project can be run very smoothly under RELEASE
mode.<BR>>><BR>>>Can anyone help me? Thanks in
advance.<BR>>><BR>>>--------------<BR>>>jimmy<BR>>>2007-07-21
<BR>>><BR>>><BR>>>_______________________________________________<BR>>>Insight-users
mailing list<BR>>><A
href="mailto:Insight-users@itk.org">Insight-users@itk.org</A><BR>>><A
href="http://www.itk.org/mailman/listinfo/insight-users">
http://www.itk.org/mailman/listinfo/insight-users</A><BR>>><BR>><BR>><BR></BLOCKQUOTE></DIV><BR></FONT></DIV></BODY></HTML>