2

我在“itk::image::Pointer salida”中有一张图片。我已经检查过它是否具有正确的像素值。我想将图像保存到文件中,但在最后一行,它给了我一个异常,现在我不知道该怎么办:

// Saving the result into a file
salida = ui.imageframe->imagereader;
writer = itk::ImageFileWriter<ImageType>::New(); 
writer->SetInput( salida ) ; 
writer->SetFileName ( "output.jpeg");
writer->Update();// ---> EXCEPTION!!

异常进入 xmtx.c 文件(mutex[mutual exclude] support for VC++),它进入这部分代码的最后一行:

_RELIABILITY_CONTRACT
void  __CLRCALL_PURE_OR_CDECL _Mtxlock(_Rmtx *_Mtx)
{   /* lock mutex */
#ifdef _M_CEE
System::Threading::Thread::BeginThreadAffinity();
#endif
EnterCriticalSection(_Mtx);
}

你们中有人遇到过同样的问题吗?任何修复它的提示?

提前致谢

安东尼奥·戈麦斯·巴克罗

4

1 回答 1

4

尝试捕获异常并查看它包含的内容。我不熟悉itk,但查看API,以下应该可以工作:

try
{
    writer->Update();
}
catch( itk::ExceptionObject& ex )
{
    qDebug() << ex.what();
}

这应该会引导您找到异常的来源。

于 2011-09-14T14:14:39.500 回答