diff --git a/cmp/binary/linux2/bit64/DTB_P0 b/cmp/binary/linux2/bit64/DTB_P0 index 1c6231a..6e43fc7 100755 Binary files a/cmp/binary/linux2/bit64/DTB_P0 and b/cmp/binary/linux2/bit64/DTB_P0 differ diff --git a/cmp/binary/linux2/bit64/DTB_dtk2dir b/cmp/binary/linux2/bit64/DTB_dtk2dir index 3c05f89..b5bcff6 100755 Binary files a/cmp/binary/linux2/bit64/DTB_dtk2dir and b/cmp/binary/linux2/bit64/DTB_dtk2dir differ diff --git a/cmp/binary/linux2/bit64/DTB_gfa b/cmp/binary/linux2/bit64/DTB_gfa index 4ad4a20..a516f86 100755 Binary files a/cmp/binary/linux2/bit64/DTB_gfa and b/cmp/binary/linux2/bit64/DTB_gfa differ diff --git a/cmp/binary/linux2/bit64/DTB_streamline b/cmp/binary/linux2/bit64/DTB_streamline index 7da7128..1a1486b 100755 Binary files a/cmp/binary/linux2/bit64/DTB_streamline and b/cmp/binary/linux2/bit64/DTB_streamline differ diff --git a/cmp/configuration.py b/cmp/configuration.py index af53502..7ae0812 100644 --- a/cmp/configuration.py +++ b/cmp/configuration.py @@ -5,8 +5,11 @@ # This software is distributed under the open-source license Modified BSD. """ The configuration is based on traits and used to create the configuration for a project. """ +try: + import traits.api as traits +except ImportError: + import enthought.traits.api as traits -import enthought.traits.api as traits import os.path as op, os import sys import datetime as dt @@ -392,7 +395,6 @@ def get_dicomfiles(self, modality): # discover files with *.* and * difiles = sorted( glob(op.join(pat, '*.*')) + glob(op.join(pat, '*')) ) - # exclude potential .nii and .nii.gz files difiles = [e for e in difiles if not e.endswith('.nii') and not e.endswith('.nii.gz')] diff --git a/cmp/connectome.py b/cmp/connectome.py index aea1b0d..6e5ac6f 100644 --- a/cmp/connectome.py +++ b/cmp/connectome.py @@ -31,6 +31,7 @@ def setup_pipeline_status(cobj): for stage,stageEnabled in stages: cobj.pipeline_status.AddStage( stage.__name__, True ) + if hasattr(stage,'declare_inputs'): stage.declare_inputs(cobj) if hasattr(stage,'declare_outputs'): diff --git a/cmp/gui.py b/cmp/gui.py index d045e05..2329168 100644 --- a/cmp/gui.py +++ b/cmp/gui.py @@ -10,14 +10,25 @@ import traceback #import threading -from enthought.traits.api import HasTraits, Int, Str, Directory, List,\ +try: + from traits.api import HasTraits, Int, Str, Directory, List,\ Bool, File, Button, Enum, Instance - -from enthought.traits.ui.api import View, Item, HGroup, Handler, \ +except ImportError: + from enthought.traits.api import HasTraits, Int, Str, Directory, List,\ + Bool, File, Button, Enum, Instance + +try: + from traitsui.api import View, Item, HGroup, Handler, \ + message, spring, Group, VGroup, TableEditor, UIInfo +except ImportError: + from enthought.traits.ui.api import View, Item, HGroup, Handler, \ message, spring, Group, VGroup, TableEditor, UIInfo - -from enthought.traits.ui.table_column \ +try: + from traitsui.table_column \ + import ObjectColumn +except ImportError: + from enthought.traits.ui.table_column \ import ObjectColumn import cmp @@ -462,7 +473,10 @@ def _help_fired(self): def load_state(self, cmpconfigfile): """ Load CMP Configuration state directly. Useful if you do not want to invoke the GUI""" - import enthought.sweet_pickle as sp + try: + import apptools.sweet_pickle as sp + except ImportError: + import enthought.sweet_pickle as sp output = open(cmpconfigfile, 'rb') data = sp.load(output) self.__setstate__(data.__getstate__()) @@ -488,7 +502,11 @@ def save_state(self, cmpconfigfile): if not os.path.exists(os.path.dirname(cmpconfigfile)): os.makedirs(os.path.abspath(os.path.dirname(cmpconfigfile))) - import enthought.sweet_pickle as sp + try: + import apptools.sweet_pickle as sp + except ImportError: + import enthought.sweet_pickle as sp + output = open(cmpconfigfile, 'wb') # Pickle the list using the highest protocol available. # copy object first @@ -594,8 +612,14 @@ def _run_fired(self): #cmpthread.start() def _load_fired(self): - import enthought.sweet_pickle as sp - from enthought.pyface.api import FileDialog, OK + try: + import apptools.sweet_pickle as sp + except ImportError: + import enthought.sweet_pickle as sp + try: + from pyface.api import FileDialog, OK + except ImportError: + from enthought.pyface.api import FileDialog, OK wildcard = "CMP Configuration State (*.pkl)|*.pkl|" \ "All files (*.*)|*.*" @@ -611,9 +635,15 @@ def _load_fired(self): def _save_fired(self): import pickle - import enthought.sweet_pickle as sp + try: + import apptools.sweet_pickle as sp + except ImportError: + import enthought.sweet_pickle as sp import os.path - from enthought.pyface.api import FileDialog, OK + try: + from pyface.api import FileDialog, OK + except ImportError: + from enthought.pyface.api import FileDialog, OK wildcard = "CMP Configuration State (*.pkl)|*.pkl|" \ "All files (*.*)|*.*" diff --git a/cmp/helpgui.py b/cmp/helpgui.py index 611e083..746a4f6 100644 --- a/cmp/helpgui.py +++ b/cmp/helpgui.py @@ -4,10 +4,22 @@ # # This software is distributed under the open-source license Modified BSD. -from enthought.traits.api import HasTraits, Int, Str, Directory, List,\ +# try to import the new traits library +try: + from traits.api import HasTraits, Int, Str, Directory, List,\ Bool, File, Button, Enum - -from enthought.traits.ui.api import View, Item, HGroup, Handler, \ +# look for the old traits library if the new one is not found +except ImportError: + from enthought.traits.api import HasTraits, Int, Str, Directory, List,\ + Bool, File, Button, Enum + +# try to import the new traits library +try: + from traitsui.api import View, Item, HGroup, Handler, \ + message, spring, Group, VGroup, TableEditor +# look for the old traits library if the new one is not found +except ImportError: + from enthought.traits.ui.api import View, Item, HGroup, Handler, \ message, spring, Group, VGroup, TableEditor from cmp import __version__ @@ -82,4 +94,4 @@ class HelpDialog ( HasTraits ): def _sections_changed(self, value): self.stagedescription = desc[value] - \ No newline at end of file + diff --git a/cmp/pipeline/pipeline_pb2.py b/cmp/pipeline/pipeline_pb2.py index 4cb7346..8146a2e 100644 --- a/cmp/pipeline/pipeline_pb2.py +++ b/cmp/pipeline/pipeline_pb2.py @@ -3,181 +3,224 @@ from google.protobuf import descriptor from google.protobuf import message from google.protobuf import reflection -from google.protobuf import service -from google.protobuf import service_reflection from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + + + +DESCRIPTOR = descriptor.FileDescriptor( + name='pipeline.proto', + package='', + serialized_pb='\n\x0epipeline.proto\"T\n\x10StageInputOutput\x12\x10\n\x08\x66ilePath\x18\x01 \x02(\t\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\x0f\n\x07rootDir\x18\x03 \x02(\t\x12\x0f\n\x07typeTag\x18\x04 \x01(\t\"i\n\x05Stage\x12\x0b\n\x03num\x18\x01 \x02(\x05\x12\x0c\n\x04name\x18\x02 \x02(\t\x12!\n\x06inputs\x18\x03 \x03(\x0b\x32\x11.StageInputOutput\x12\"\n\x07outputs\x18\x04 \x03(\x0b\x32\x11.StageInputOutput\"!\n\x04Type\x12\x0b\n\x03tag\x18\x01 \x02(\t\x12\x0c\n\x04\x64\x65sc\x18\x02 \x02(\t\"F\n\x08Pipeline\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x16\n\x06stages\x18\x02 \x03(\x0b\x32\x06.Stage\x12\x14\n\x05types\x18\x03 \x03(\x0b\x32\x05.Type') + _STAGEINPUTOUTPUT = descriptor.Descriptor( name='StageInputOutput', full_name='StageInputOutput', - filename='pipeline.proto', + filename=None, + file=DESCRIPTOR, containing_type=None, fields=[ descriptor.FieldDescriptor( name='filePath', full_name='StageInputOutput.filePath', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='name', full_name='StageInputOutput.name', index=1, number=2, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='rootDir', full_name='StageInputOutput.rootDir', index=2, number=3, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='typeTag', full_name='StageInputOutput.typeTag', index=3, number=4, type=9, cpp_type=9, label=1, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], - nested_types=[], # TODO(robinson): Implement. + nested_types=[], enum_types=[ ], - options=None) + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=18, + serialized_end=102, +) _STAGE = descriptor.Descriptor( name='Stage', full_name='Stage', - filename='pipeline.proto', + filename=None, + file=DESCRIPTOR, containing_type=None, fields=[ descriptor.FieldDescriptor( name='num', full_name='Stage.num', index=0, number=1, type=5, cpp_type=1, label=2, - default_value=0, + has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='name', full_name='Stage.name', index=1, number=2, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='inputs', full_name='Stage.inputs', index=2, number=3, type=11, cpp_type=10, label=3, - default_value=[], + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='outputs', full_name='Stage.outputs', index=3, number=4, type=11, cpp_type=10, label=3, - default_value=[], + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], - nested_types=[], # TODO(robinson): Implement. + nested_types=[], enum_types=[ ], - options=None) + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=104, + serialized_end=209, +) _TYPE = descriptor.Descriptor( name='Type', full_name='Type', - filename='pipeline.proto', + filename=None, + file=DESCRIPTOR, containing_type=None, fields=[ descriptor.FieldDescriptor( name='tag', full_name='Type.tag', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='desc', full_name='Type.desc', index=1, number=2, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], - nested_types=[], # TODO(robinson): Implement. + nested_types=[], enum_types=[ ], - options=None) + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=211, + serialized_end=244, +) _PIPELINE = descriptor.Descriptor( name='Pipeline', full_name='Pipeline', - filename='pipeline.proto', + filename=None, + file=DESCRIPTOR, containing_type=None, fields=[ descriptor.FieldDescriptor( name='name', full_name='Pipeline.name', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + has_default_value=False, default_value=unicode("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='stages', full_name='Pipeline.stages', index=1, number=2, type=11, cpp_type=10, label=3, - default_value=[], + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='types', full_name='Pipeline.types', index=2, number=3, type=11, cpp_type=10, label=3, - default_value=[], + has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), ], extensions=[ ], - nested_types=[], # TODO(robinson): Implement. + nested_types=[], enum_types=[ ], - options=None) - + options=None, + is_extendable=False, + extension_ranges=[], + serialized_start=246, + serialized_end=316, +) _STAGE.fields_by_name['inputs'].message_type = _STAGEINPUTOUTPUT _STAGE.fields_by_name['outputs'].message_type = _STAGEINPUTOUTPUT _PIPELINE.fields_by_name['stages'].message_type = _STAGE _PIPELINE.fields_by_name['types'].message_type = _TYPE +DESCRIPTOR.message_types_by_name['StageInputOutput'] = _STAGEINPUTOUTPUT +DESCRIPTOR.message_types_by_name['Stage'] = _STAGE +DESCRIPTOR.message_types_by_name['Type'] = _TYPE +DESCRIPTOR.message_types_by_name['Pipeline'] = _PIPELINE class StageInputOutput(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _STAGEINPUTOUTPUT + + # @@protoc_insertion_point(class_scope:StageInputOutput) class Stage(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _STAGE + + # @@protoc_insertion_point(class_scope:Stage) class Type(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _TYPE + + # @@protoc_insertion_point(class_scope:Type) class Pipeline(message.Message): __metaclass__ = reflection.GeneratedProtocolMessageType DESCRIPTOR = _PIPELINE + + # @@protoc_insertion_point(class_scope:Pipeline) +# @@protoc_insertion_point(module_scope) diff --git a/cmp/stages/converter/dicomconverter.py b/cmp/stages/converter/dicomconverter.py index 4f44a50..8020f5d 100644 --- a/cmp/stages/converter/dicomconverter.py +++ b/cmp/stages/converter/dicomconverter.py @@ -386,6 +386,9 @@ def declare_inputs(conf): conf.pipeline_status.AddStageInput(stage, pat, file, 'dsi-dcm') elif conf.diffusion_imaging_model == 'DTI' and conf.do_convert_diffusion: + print 'dicom reader home: ' + conf.get_cmp_home() + print 'dicom reader rdp: ' + conf.get_rawdata() + print 'dicom reader log: ' + conf.get_log() first = conf.get_dicomfiles( 'diffusion')[0] pat, file = op.split(first) conf.pipeline_status.AddStageInput(stage, pat, file, 'dti-dcm') diff --git a/cmp/util.py b/cmp/util.py index f13c29b..039ac7f 100644 --- a/cmp/util.py +++ b/cmp/util.py @@ -9,7 +9,10 @@ import subprocess import numpy as np from logme import * -from enthought.traits.api import HasStrictTraits, Str +try: + from traits.api import HasStrictTraits, Str +except ImportError: + from enthought.traits.api import HasStrictTraits, Str import networkx as nx try: @@ -243,4 +246,4 @@ def mean_curvature(xyz): #Curvature k = magn(np.cross(dxyz,ddxyz),1)/(magn(dxyz,1)**3) - return np.mean(k) \ No newline at end of file + return np.mean(k) diff --git a/src/DTB/CMakeLists.txt b/src/DTB/CMakeLists.txt index 751c84a..0e110e4 100644 --- a/src/DTB/CMakeLists.txt +++ b/src/DTB/CMakeLists.txt @@ -14,7 +14,7 @@ set( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake" ) FIND_PACKAGE ( BLITZ REQUIRED ) FIND_PACKAGE ( NIFTI REQUIRED ) -FIND_PACKAGE( Boost 1.40.0 REQUIRED COMPONENTS program_options ) +FIND_PACKAGE( Boost REQUIRED COMPONENTS program_options ) SET(Boost_USE_STATIC_LIBS ON) SET(Boost_USE_MULTITHREAD OFF)