Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified cmp/binary/linux2/bit64/DTB_P0
Binary file not shown.
Binary file modified cmp/binary/linux2/bit64/DTB_dtk2dir
Binary file not shown.
Binary file modified cmp/binary/linux2/bit64/DTB_gfa
Binary file not shown.
Binary file modified cmp/binary/linux2/bit64/DTB_streamline
Binary file not shown.
6 changes: 4 additions & 2 deletions cmp/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')]

Expand Down
1 change: 1 addition & 0 deletions cmp/connectome.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'):
Expand Down
52 changes: 41 additions & 11 deletions cmp/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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__())
Expand All @@ -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
Expand Down Expand Up @@ -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 (*.*)|*.*"
Expand All @@ -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 (*.*)|*.*"
Expand Down
20 changes: 16 additions & 4 deletions cmp/helpgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down Expand Up @@ -82,4 +94,4 @@ class HelpDialog ( HasTraits ):
def _sections_changed(self, value):

self.stagedescription = desc[value]


Loading