<s> import numpy <EOL> from enthought . traits . api import HasTraits <EOL> class SegmentorBase ( HasTraits ) : <EOL> name = "<STR_LIT>" <EOL> description = "<STR_LIT>" <EOL> author = "<STR_LIT>" <EOL> homepage = "<STR_LIT>" <EOL> minContext = - <NUM_LIT:1> <EOL> def __init__ ( self ) : <EOL> self . weights = None <EOL> self . volumeBasinsWithBorders = None <EOL> self . volumeBasins = None <EOL> self . segmentation = None <EOL> def segment ( self , labelVolume , labelValues , labelIndices ) : <EOL> """<STR_LIT>""" <EOL> print "<STR_LIT>" , labelVolume . dtype , labelVolume . shape <EOL> print "<STR_LIT>" , labelValues . dtype , labelValues . shape <EOL> print "<STR_LIT>" , labelIndices . dtype , labelIndices . shape <EOL> if labelValues . dtype != numpy . uint8 : <EOL> print "<STR_LIT>" <EOL> labelValues = labelValues . astype ( '<STR_LIT>' ) <EOL> if labelIndices . dtype != numpy . uint32 : <EOL> print "<STR_LIT>" <EOL> labelIndices = labelIndices . astype ( '<STR_LIT>' ) <EOL> self . segmentation = self . segment3D ( labelVolume , labelValues , labelIndices ) <EOL> return self . segmentation <EOL> def setupWeights ( self , weights ) : <EOL> """<STR_LIT>""" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" , weights . dtype , weights . shape <EOL> self . weights = weights <EOL> def settings ( self ) : <EOL> self . configure_traits ( kind = '<STR_LIT>' , view = '<STR_LIT>' ) <EOL> def getInlineSettingsWidget ( self , parent , view = '<STR_LIT>' ) : <EOL> try : <EOL> ui = self . edit_traits ( view , parent = parent , kind = '<STR_LIT>' ) . control <EOL> return ui <EOL> except : <EOL> print "<STR_LIT>" , self . name <EOL> return None </s>
