Beispiel #1
0
 def reindex(self):
     # bar.barSBAParser.reindex(self)
     # self.indexer.createFlatHierarchy()
     self.indexer.colorMapping = dict((cleanStructName(v),k) for k, v in self._sbaImportData['rgb2acr'].iteritems())
     self.indexer.fullNameMapping = self._sbaImportData['acr2full'] 
     
     # And the just store the results into the txt files so they can be
     # further preocessed by the volumetric parser.
     
     # Ditry hack stripping all keys and values. It is required as provided
     self.indexer.fullNameMapping = dict(
         (cleanStructName(k),v )\
         for k, v in self.indexer.fullNameMapping.iteritems())
     
     # Define mappings for all the files that will be used in other processings
     fullNameMappingPath = os.path.join(self.inputDirectory, CONF_FULLNAME_MAPPING_FILE)
     colorMappingPath = os.path.join(self.inputDirectory, CONF_COLOR_MAPPING_FILE)
     volIdxToAbbrevPath = os.path.join(self.inputDirectory, CONF_VOLUME_LABEL_MAPPING_FILE)
     volIdxToAbbrevSrcPath = os.path.join(self.inputDirectory, CONF_VOLUME_LABEL_MAPPING_SOURCE)
     
     # Load additional mappings from json files
     volumeToAbbrevMapping = json.load(open(volIdxToAbbrevSrcPath))
     colorToStructureMapping = dict(map(lambda (k,v): \
             (str(k), cleanStructName(v)), enumerate(volumeToAbbrevMapping)))
     
     # And then store them into files
     self._writeDictionaryToFile(self.indexer.colorMapping, colorMappingPath)
     self._writeDictionaryToFile(self.indexer.fullNameMapping, fullNameMappingPath)
     self._writeDictionaryToFile(colorToStructureMapping, volIdxToAbbrevPath)
Beispiel #2
0
 def __getImageToAbbrevMapping(self):
     volIdxToAbbrevSrcPath = os.path.join(self.inputDirectory, CONF_VOLUME_LABEL_MAPPING_SOURCE)
     volumeToAbbrevMapping = json.load(open(volIdxToAbbrevSrcPath))
     mapping = dict( \
             (str(k), cleanStructName(v)) \
             for k, v \
             in enumerate(volumeToAbbrevMapping) )
     return mapping
Beispiel #3
0
 def __getImageToAbbrevMapping(self):
     volIdxToAbbrevSrcPath = os.path.join(self.inputDirectory,
                                          CONF_VOLUME_LABEL_MAPPING_SOURCE)
     volumeToAbbrevMapping = json.load(open(volIdxToAbbrevSrcPath))
     mapping = dict( \
             (str(k), cleanStructName(v)) \
             for k, v \
             in enumerate(volumeToAbbrevMapping) )
     return mapping
Beispiel #4
0
 def __getFullnameMapping(self):
     mapping = dict( \
             (cleanStructName(k),v )\
             for k, v \
             in self._sbaImportData['acr2full'].iteritems() )
     return mapping
Beispiel #5
0
 def __getColorMapping(self):
     colorMapping = dict(\
                 (cleanStructName(v), k) \
                 for k, v \
                 in self._sbaImportData['rgb2acr'].iteritems() )
     return colorMapping
Beispiel #6
0
 def __getFullnameMapping(self):
     mapping = dict( \
             (cleanStructName(k),v )\
             for k, v \
             in self._sbaImportData['acr2full'].iteritems() )
     return mapping
Beispiel #7
0
 def __getColorMapping(self):
     colorMapping = dict(\
                 (cleanStructName(v), k) \
                 for k, v \
                 in self._sbaImportData['rgb2acr'].iteritems() )
     return colorMapping