Skip to content

XmippPythonization

Adrian Quintana edited this page Dec 11, 2017 · 1 revision

Xmipp Pythonization

  • Configure the compilation with swig=yes

./scons.configure ... swig=yes


  • set the PYTHONPATH variable

setenv PYTHONPATH /home/bioing/trunk/xmipp/lib


  • Pythonize a whole header

%{
#include "../de_solver.h"
%}
%include "../de_solver.h"


  • Pythonize a whole header except a few functions

%{
#include "../args.h"
%}

%ignore firstToken(const std::string& str);		

%include "../args.h"


  • Pythonize only a few functions of a header

%{
#include "../args.h"
%}

extern firstToken(const std::string& str);		


  • Invoke python

setenv PYTHONPATH /home/bioing/xmipp/lib
python
import XmippData


  • Alternative Python invocation

python

import os,glob,sys
scriptdir=os.path.split(os.path.dirname(os.popen('which xmipp_protocols','r').read()))[0]+'/lib'
sys.path.append(scriptdir) # add default search path
import XmippData


-- Main.CoSS - 28 Nov 2007

Clone this wiki locally