Hi everybody.
I've written a class to read and write EM maps in Spider format in IMP. Runs perfect in C++ when combined with DensityMap and MRCReaderWriter from EMbed:
#include "IMP/em/SpiderReaderWriter.h"
#include "DensityMap.h"
#include "MRCReaderWriter.h"
int main() {
// Constructor
IMP::em::SpiderMapReaderWriter rw("media_mon_iter3.xmp",false,false,true);
MRCReaderWriter rw2;
DensityMap m;
m.Read("media_mon_iter3.xmp",rw);
m.Write("test.xmp",rw);
m.Write("test.mrc",rw2);
}
When wrapped in Python, after modifying modules/em/pyext/em.i with this:
%import "MapReaderWriter.h"
%include "IMP/em/SpiderReaderWriter.h"
And trying to do exactly the same thing:
def test_em_maps(self):
"""Check volume reading and writing"""
rw1=em.SpiderMapReaderWriter("media_mon_iter3.xmp",False,False,True)
rw2=EM.MRCReaderWriter()
m=EM.DensityMap()
m.Read("media_mon_iter3.xmp",rw1)
m.Write("test.mrc",rw2)
m.Write("test.xmp",rw1)
I obtain this error:
======================================================================
ERROR: Check volume reading and writing
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_volumes_and_images.py", line 74, in test_em_maps
m.Read("media_mon_iter3.xmp",rw1)
File "/diva1/home/modeller/SVN/modlib/EM.py", line 698, in Read
def Read(*args): return _EM.DensityMap_Read(*args)
TypeError: in method 'DensityMap_Read', argument 3 of type 'MapReaderWriter &'
----------------------------------------------------------------------
Seems that SWIG is not wrapping properly MapReaderWriter or is getting confused by passing a IMP object like SpiderMapReaderWriter to the EMbed class DensityMap. Any help?
Thanks