[Insight-users] runtime error !

Rodrigo Trujillo Rodrigo Trujillo" <rodrigo.trujillo at cenpra.gov.br
Mon, 5 Apr 2004 21:29:30 -0300


Hi,

The problem may be in the type of your image.
Are you sure that the type is Float ??
Try to make a CAST (vtkImageCast) before ITK pipeline.

Rodrigo Trujillo



----- Original Message ----- 
From: "xujf" <xujf at sjtu.edu.cn>
To: <insight-users at itk.org>
Sent: Wednesday, April 07, 2004 10:22 AM
Subject: Re: Re: [Insight-users] runtime error !


> On Wed, 2004-04-07 at 04:35, xujf wrote:
> > Hi,Charl P.Botha and Rodrigo Truiillo:
> >     with your help, my code had no syntax errors.
> >     when I finished my code,I ran it.an error dialog appeared:
> >     "Rumtime Error!
> >     Program:C:\\python23\\python.exe
> >     This application has requested the Runtime to terminate it in an
unusual way.
> >     Please connact the application \\\'s support team for more
information "
>
> The problem is that the ITK wrappings propagate C++ exceptions to
> Python, but you\'re driving the pipeline from the VTK side, so the
> exceptions aren\'t being handled and cause your application to stop
> without a usable message.  I\'ve made changes recently in VTK so that VTK
> also catches exceptions when a vtkImageImport is used, but you\'re
> probably using a non-CVS version.
>
> Until then, always call Update() on the last ITK class in your ITK
> pipeline before you make any VTK calls which might update the whole
> pipeline.  This way you\'ll see what error is making your app stop.
>
> Good luck,
> Charl
>
> Charl:
>   I shorten my code as follow in order to find where errors occurs.my code
is as follow:
>
> import sys,os
> import paths
> import InsightToolkit as itk
> from vtkMINCReader  import *
> import ConnectVTKITK as connect
>
> reader=vtkMINCReader()
> vtkexport=vtkImageExport()
>
> vtkexport.SetInput(reader.GetOutput())
> reader.SetFileName("E:/atamai/2003-01-27/atamai/examplesPmw/sbrain.mnc")
>
> itkimport=itk.itkVTKImageImportF3_New()
>
> connect.ConnectVTKToITKF3(vtkexport,itkimport.GetPointer())
>
> itkimport.Update()
>
> this time I can find my errors:
> Traceback (most recent call last):
> File "fastmarching.py", line 57, in ?
>     itkimport.Update()
> File "E:\\Bin\\ITK\\bin\\release\\itkVTKImageImport.py", line 982, in
Update
>     def Update(*args): return
_itkVTKImageImport.itkVTKImageImportF3_Pointer_Updat(*args)
> RuntimeError: E:\\ITK6\\Code\\BasicFilters\\itkVTKImageImport.txx:239:
> itk::ERROR: VTKImageImport(06099EF0): Input scalar type is short but
should be f
> loat
>
> I think maybe this error occurs just because of the sentence
"connect.ConnectVTKToITKF3(vtkexport,itkimport.GetPointer())".How should I
correct it?
>
> Best Regards!
> xujf
>
>