[Insight-users] Display image
with ITK+VTK in SDI Applica tion
Alexander.Wang
zjjywmy at 163.com
Thu May 11 22:50:09 EDT 2006
Hi Iván,
Thanks for your help. I have replaced the version of ITKCommon.dll and very happy to see that exception never occurs again. However, anther error appears which says:
Debug assertion failed!
Program:...\..\..\***.exe
File:dbgheap.c
Line:1011
Expresion:_CrtIsValidHeapPointer(pUserData)
For your information on how your program can cause an assertion
failure,see the Visual C++ documentations on asserts.
I google to find some related info. They said,
(1)This is a problem with fltk.
I suppose you are running the example in debug version.
By default ITK is using the release version of fltk libraries so if you run the example in debug it will fail.
Try to run it in Release mode and that should work.
If you want to use the debug version you could modify the project
options by hand
in VC++ and replace fltk.lib by fltkd.lib, fltkgl.lib by fltkgld.lib
...etc...
Julien
------>But I don't use fltk in this program, though i compiled that before.
(2)If you are developing multithread application, be sure to link it with the correct runtime library(/MD, /MT). That what "The pointer MUST come from the 'local' heap." means.
Check what "runtime library" you use. It should be "Multithreaded (debug) DLL"
Roman
------>I checked that the setting of "runtime library" is right.
Could you or anybody else give me some advice.
Thanks for attention!
Alexander
-----原始邮件-----
发件人:"Iván Macía"
发送时间:2006-05-11 16:03:53
收件人:"'Alexander.Wang'" ,"'karthik krishnan'"
抄送:"'insight-users'"
主题:RE: Re: [Insight-users] Display image with ITK+VTK in SDI Applica tion
Hi Alexander,
Does this error always show up in Debug mode? Are you using ITK with dynamic libraries? If so this could be due to your application accessing the wrong version of itkCommon.dll (accessing Release version instead of Debug), as both have the same name. This happened to me before.
Hope that helps
Iván
De: insight-users-bounces+imacia=vicomtech.es at itk.org [mailto:insight-users-bounces+imacia=vicomtech.es at itk.org] En nombre de Alexander.Wang
Enviado el: jueves, 11 de mayo de 2006 9:51
Para: karthik krishnan
CC: insight-users
Asunto: Re: Re: [Insight-users] Display image with ITK+VTK in SDI Applica tion
Hi,
Thanks for your warmly help. But it seems not because of the filename's slashes. When i change the filename as the method your proposed, the exception was thrown out as before. And further more, i succeed in displaying image in Win32 console application, using both '\' and '/'. So i think the bug lies somewhere esle.
Thanks again and i'll appreciate your further help!
-----原始邮件-----
发件人:"Karthik Krishnan"
发送时间:2006-05-10 23:11:42
收件人:"Alexander.Wang"
抄送:insight-users at itk.org
主题:Re: [Insight-users] Display image with ITK+VTK in SDI Applica tion
On Wed, 2006-05-10 at 22:07 +0800, Alexander.Wang wrote:
> Hi users,
>
> I recently started working on ITK, and I want to display images in
> windows using SDI Application. But there is some problem. When the
> Update() function of imagereader is executing, an exception is thrown
> out which says" Unhandles exception in ***.exe (KERNEL32.DLL):
> 0xE06D7363: Microsoft C++ Exception". Does anybody could give me some
> help? Thanks in advance.
>
> Sincerely, Alexander
> CString strFile="";
> char szFilter[]="bmp文件(*.bmp)|*.bmp|All files(*.*)|*.*||";
> CFileDialog dlg(TRUE,"bmp",NULL,OFN_HIDEREADONLY|
> OFN_OVERWRITEPROMPT,szFilter,this);
> dlg.m_ofn.lpstrInitialDir=".";
>
> if(dlg.DoModal()==IDOK)
> {
> strFile=dlg.GetPathName();
> }
>
> imageReader2D_1->SetFileName( strFile );
>
I suspect the filename's slashes are getting escaped. It should end up
looking like c:/foo/foo.png or like "c:\\foo\\foo.png" You could use
itksys to convert these paths from the native windows style paths.
#include "itksys/SystemTools.hxx"
std::string fname = strFile
itksys::SystemTools::ConvertToUnixSlashes(fname);
if (!itksys::SystemTools::FileExists(fname.c_str()))
{
std::cerr << fname << " doesn't exist.. check again" << std::endl;
}
> //Exception thrown out when executing this expression
> imageReader2D_1->Update();
>
> vtkImageViewer* viewer=vtkImageViewer::New();
> vtkRenderWindowInteractor*
> ImgRenderWindowInteractor=vtkRenderWindowInteractor::New();
>
> connector->SetInput(imageReader2D_1->GetOutput());
>
> HWND hwnd = this->GetSafeHwnd();
>
> viewer->SetParentId(hwnd);
> viewer->SetPosition(0,0);
> viewer->SetSize(512,512);
> viewer->SetupInteractor(ImgRenderWindowInteractor);
>
> viewer->SetInput(connector->GetOutput());
> viewer->Render();
>
> viewer->SetColorWindow(255);
> viewer->SetColorLevel(128);
> ImgRenderWindowInteractor->Start();
>
> //Code End
>
>
>
>
>
>
>
>
>
> 你 不 想 试 试 今 夏 最 “酷” 的 邮 箱 吗 ?
> 蕴 涵 中 华 传 统 文 化 于 世 界 一 流 科 技 之 中,创 新 Ajax 技 术,
> 126 “D 计 划”火 热 体 验 中 !
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
你 不 想 试 试 今 夏 最 “酷” 的 邮 箱 吗 ?
蕴 涵 中 华 传 统 文 化 于 世 界 一 流 科 技 之 中,创 新 Ajax 技 术,126 “D 计 划”火 热 体 验 中 !
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060512/abce26f2/attachment.html
More information about the Insight-users
mailing list