(NumPy community, read on this only seems unrelated)
I use NumPy 1.0.3 , MSVC 2005 Express, ITK CVS from
23Jul2007, WrapITK for Python only, wrap for the standard types plus signed short
(imho that should be switched on by default because many DICOM images are in
that type). BTW I had to include the /bigobj compiler switch in the CMakeLists.txt
for ITK for that to work. ItkVtkGlue compiled, but PyBuffer gave errors:
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
and
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
at several occasions. At these line numbers, the numarray function
import_array() is called. I checked the numarray code and import_array() is a #define
that does not return a value:
#define import_array() {if (_import_array() < 0)
{PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return; } }
I realize that’s more a problem with numarray than PyBuffer. Since
that’s inline-used the compiler is probably thwarted by the return inside
the macro. Consequently, if I replace the #define with a void to make it a real
function call PyBuffer compiles just fine.
Thanks,
Sven
Here is the whole build log:
1>------ Build started:
Project: _BufferConversionPython, Configuration: Release Win32 ------
1>Generating
wrap_itkPyBuffer.xml
1>Generating
wrap_itkPyBuffer.idx
1>Generating
wrap_itkPyBufferPython.cxx
1>Generating
wrap_BufferConversionPythonPython.cxx
1>create swig package
BufferConversionPython
1> init module:
itkPyBuffer
1>Compiling...
1>wrap_itkPyBufferPython.cxx
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,3>,
1>
TPixel=unsigned char,
1>
VImageDimension=3
1>
]
1>
.\wrap_itkPyBufferPython.cxx(1542) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType>
itk::PyBuffer<TImage>::GetImageFromArray(PyObject *)'
1>
with
1>
[
1>
TObjectType=itk::Image<unsigned char,3>,
1>
TImage=itk::Image<unsigned char,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<float,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<float,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<float,3>,
1>
TPixel=float,
1>
VImageDimension=3
1>
]
1>
.\wrap_itkPyBufferPython.cxx(1646) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<float,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<float,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<float,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType>
itk::PyBuffer<TImage>::GetImageFromArray(PyObject *)'
1>
with
1>
[
1>
TObjectType=itk::Image<float,3>,
1>
TImage=itk::Image<float,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<float,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<float,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<float,2>,
1>
TPixel=float,
1>
VImageDimension=2
1>
]
1>
.\wrap_itkPyBufferPython.cxx(1750) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<float,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<float,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<float,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType>
itk::PyBuffer<TImage>::GetImageFromArray(PyObject *)'
1>
with
1>
[
1>
TObjectType=itk::Image<float,2>,
1>
TImage=itk::Image<float,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1> with
1>
[
1>
TImage=itk::Image<unsigned short,3>,
1>
TPixel=unsigned short,
1>
VImageDimension=3
1>
]
1>
.\wrap_itkPyBufferPython.cxx(1854) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType>
itk::PyBuffer<TImage>::GetImageFromArray(PyObject *)'
1>
with
1>
[
1>
TObjectType=itk::Image<unsigned short,3>,
1>
TImage=itk::Image<unsigned short,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,2>,
1>
TPixel=unsigned char,
1>
VImageDimension=2
1>
]
1>
.\wrap_itkPyBufferPython.cxx(1958) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<unsigned char,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType>
itk::PyBuffer<TImage>::GetImageFromArray(PyObject *)'
1>
with
1>
[
1>
TObjectType=itk::Image<unsigned char,2>,
1>
TImage=itk::Image<unsigned char,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1> with
1>
[
1>
TImage=itk::Image<unsigned short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1> with
1>
[
1>
TImage=itk::Image<unsigned short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,2>,
1>
TPixel=unsigned short,
1>
VImageDimension=2
1>
]
1>
.\wrap_itkPyBufferPython.cxx(2062) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<unsigned short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType> itk::PyBuffer<TImage>::GetImageFromArray(PyObject
*)'
1>
with
1>
[
1>
TObjectType=itk::Image<unsigned short,2>,
1>
TImage=itk::Image<unsigned short,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<short,3>,
1>
TPixel=short,
1>
VImageDimension=3
1>
]
1>
.\wrap_itkPyBufferPython.cxx(2151) : see reference to class template
instantiation 'itk::PyBuffer<TImage>' being compiled
1>
with
1>
[
1>
TImage=itk::Image<short,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<short,3>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType> itk::PyBuffer<TImage>::GetImageFromArray(PyObject
*)'
1>
with
1>
[
1>
TObjectType=itk::Image<short,3>,
1>
TImage=itk::Image<short,3>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(46)
: error C2561: 'itk::PyBuffer<TImage>::GetArrayFromImage' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(73)
: see declaration of 'itk::PyBuffer<TImage>::GetArrayFromImage'
1>
with
1>
[
1>
TImage=itk::Image<short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(38)
: while compiling class template member function 'PyObject
*itk::PyBuffer<TImage>::GetArrayFromImage(itk::Image<TPixel,VImageDimension>
*)'
1>
with
1>
[
1>
TImage=itk::Image<short,2>,
1>
TPixel=short,
1>
VImageDimension=2
1>
]
1> .\wrap_itkPyBufferPython.cxx(2240)
: see reference to class template instantiation 'itk::PyBuffer<TImage>'
being compiled
1>
with
1>
[
1>
TImage=itk::Image<short,2>
1>
]
1>c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(77)
: error C2561: 'itk::PyBuffer<TImage>::GetImageFromArray' : function must
return a value
1>
with
1>
[
1>
TImage=itk::Image<short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.h(78)
: see declaration of 'itk::PyBuffer<TImage>::GetImageFromArray'
1>
with
1>
[
1>
TImage=itk::Image<short,2>
1>
]
1>
c:\users\sprevrha\src\insight\wrapping\wrapitk\externalprojects\pybuffer\itkPyBuffer.txx(75)
: while compiling class template member function 'const
itk::SmartPointer<TObjectType>
itk::PyBuffer<TImage>::GetImageFromArray(PyObject *)'
1>
with
1>
[
1>
TObjectType=itk::Image<short,2>,
1>
TImage=itk::Image<short,2>
1>
]
1>wrap_BufferConversionPythonPython.cxx
1>Generating Code...
1>Build log was saved at
"file://c:\packages\Insight-CVS-VC2005-WrapITK-ExternalProjects\PyBuffer\_BufferConversionPython.dir\Release\BuildLog.htm"
1>_BufferConversionPython
- 16 error(s), 0 warning(s)
2>------ Build started:
Project: ALL_BUILD, Configuration: Release Win32 ------
2>"Build all
projects"
2>Build log was saved at
"file://c:\packages\Insight-CVS-VC2005-WrapITK-ExternalProjects\PyBuffer\ALL_BUILD.dir\Release\BuildLog.htm"
2>ALL_BUILD - 0 error(s),
0 warning(s)
========== Build: 1
succeeded, 1 failed, 2 up-to-date, 0 skipped ==========