[Insight-developers] WrapITK and Transform I/O
Magnotta, Vincent A
vincent-magnotta at uiowa.edu
Sun Dec 9 18:30:54 EST 2007
I have a question about WrapITK and working with the itkTransformFileReader. I am currently testing some functions in Tcl and have come against a wall. I have been able to get the itkTransformFileReader to load an ITK transform to disk. I can get the output of the filter using GetTransformList. However, I am unable to work with this list because the class std::list<itk::TransformBase::Pointer> is not wrapped. I have modified SwigExtras.i wrap_SwigExtras.h to include a new template type.
I added the following code to SwigExtras.i
template<> class list<itk::TransformBase::Pointer> {
// add specialized typemaps here
public:
list();
unsigned int size() const;
bool empty() const;
void clear();
void push_back(itk::TransformBase::Pointer x);
%extend {
itk::TransformBase::Pointer get(int i)
{
std::list<itk::TransformBase::Pointer>::iterator j = self->begin();
while(i)
{
j++;
i--;
}
return *j;
}
}
.
.
.
%template(TransformBaseList) std::list<itk::TransformBase::Pointer>;
and in wrap_SwigExtras.h I added
typedef std::list<itk::TransformBase::Pointer> TransformBaseList;
in the namespace renames section. When I load InsightToolkit in Tcl I can see the newly wrapped class
% TransformBaseList
_00e4f90c_p_std__listTitk__TransformBase__Pointer_t
However, when I get an error running the following set of commands
% set tt [itkTransformFileReader_New]
% $tt SetFileName Test.xfm
% $tt Update
% set ts [$tt GetTransformList]
% $ts
invalid command name "_f4bbf80c_p_std__listTitk__SmartPointerTitk__TransformBase_t_std__allocatorTitk__SmartPointerTitk__TransformBase_t_t_t"
I am assuming that the wrapping of ITK works differently from the SwigExtras code since the Itk wrapping has a itk__SmartPointer within the returned name. Is there a way to wrap the std::list<itk::TransformBase::Pointer> such that the TransformFileReader can be used from the wrapped language?
Thanks,
Vince
----------------------
Assistant Professor
Department of Radiology
0453-D JCP
200 Hawkins Drive
Iowa City, IA 52242
E-mail: vincent-magnotta at uiowa.edu
Phone: 319-356-8255 Fax: 319-353-6275
Website: http://www.radiology.uiowa.edu
More information about the Insight-developers
mailing list