Skip to content

Commit

Permalink
Fix errors whlie loading images (loadMpReviewProcessData()) on Slicer…
Browse files Browse the repository at this point in the history
… 4.11.20200930. See SlicerProstate/SliceTracker#358.
  • Loading branch information
tokjun committed Oct 13, 2020
1 parent 8325c20 commit b20fff8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mpReview.py
Expand Up @@ -2108,7 +2108,7 @@ def loadMpReviewProcessedData(resourcesDir, updateProgressCallback=None):

seriesMap[seriesNumber] = {'MetaInfo':None, 'NRRDLocation':volumePath,'LongName':seriesDescription}
seriesMap[seriesNumber]['ShortName'] = str(seriesNumber)+":"+seriesDescription

canonicalFile = os.path.join(os.path.split(root)[0], "Canonical", seriesNumber+".json")
try:
canonicalDict = json.load(open(canonicalFile))
Expand Down Expand Up @@ -2156,14 +2156,14 @@ def findElement(dom, name):

dom = xml.dom.minidom.parse(f)
number = findElement(dom, 'SeriesNumber')
name = self.normalizeSeriesDescription(findElement(dom, 'SeriesDescription').encode('utf-8').strip())
return number, name
name = mpReviewLogic.normalizeSeriesDescription(findElement(dom, 'SeriesDescription').encode('utf-8').strip())
return number, str(name)

@staticmethod
def normalizeSeriesDescription(name):
import re
pattern = re.compile('[^a-zA-Z0-9_ ]')
normalized_name = pattern.sub('_', name)
pattern = re.compile(b'[^a-zA-Z0-9_ ]')
normalized_name = pattern.sub(b'_', name)
return normalized_name

def formatDate(self, extractedDate):
Expand Down

0 comments on commit b20fff8

Please sign in to comment.