Skip to content

Commit

Permalink
elastix mac update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Renier committed Feb 27, 2019
1 parent ae57ca9 commit 1a0a6ef
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions ClearMap/Alignment/Elastix.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,22 @@ def setElastixLibraryPath(path = None):
if path is None:
path = settings.ElastixPath;

if os.environ.has_key('LD_LIBRARY_PATH'):
lp = os.environ['LD_LIBRARY_PATH'];
import platform
systemname = platform.system()
if systemname == 'Linux':
ldpath = 'LD_LIBRARY_PATH';
else:
ldpath = 'DYLD_LIBRARY_PATH';
print(ldpath)

if os.environ.has_key(ldpath):
lp = os.environ[ldpath];
if not path in lp.split(':'):
os.environ['LD_LIBRARY_PATH'] = lp + ':' + path;
os.environ[ldpath] = lp + ':' + path;
else:
os.environ['LD_LIBRARY_PATH'] = path
os.environ[ldpath] = path

print(os.environ[ldpath])


def initializeElastix(path = None):
Expand Down Expand Up @@ -170,6 +180,14 @@ def initializeElastix(path = None):

print "Elastix sucessfully initialized from path: %s" % path;

import platform
systemname = platform.system()
if systemname != 'Linux':
ElastixBinary = 'DYLD_LIBRARY_PATH='+elastixlib+' '+ElastixBinary
TransformixBinary = 'DYLD_LIBRARY_PATH='+elastixlib+' '+TransformixBinary

printSettings()

return path;


Expand Down

0 comments on commit 1a0a6ef

Please sign in to comment.