Skip to content

Commit

Permalink
BUG: Fixed logic bugs in computing the candidateRegion for Caudate.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjmjohnson committed Jan 15, 2013
1 parent 2446b94 commit e165eb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions AutoWorkup/PipeLineFunctionHelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def convertToList(element):
return [ element ]

def MakeInclusionMaskForGMStructures( posteriorDictionary ):
def MakeInclusionMaskForGMStructures( posteriorDictionary, candidateRegionFileName ):
import SimpleITK as sitk

AIR_FN=posteriorDictionary['AIR']
Expand All @@ -38,8 +38,12 @@ def MakeInclusionMaskForGMStructures( posteriorDictionary ):
WM_Region=sitk.BinaryThreshold(WM_PROB,0.99,1.01,1,0) #NOTE: Higher tolerance for WM regions!

outputCandidateRegion=sitk.BinaryThreshold(AIR_Region+CSF_Region+VB_Region+WM_Region,1,100,0,1) #NOTE: Inversion of input/output definitions
## Now write out the candidate region name.
import os
outputCandidateRegionFileName=os.path.realpath(candidateRegionFileName)
sitk.WriteImage(outputCandidateRegion,outputCandidateRegionFileName)

return outputCandidateRegion
return outputCandidateRegionFileName

def makeListOfValidImages(imageFile):
if imageFile is None:
Expand Down
7 changes: 4 additions & 3 deletions AutoWorkup/WorkupT1T2BRAINSCut.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,12 @@ def CreateBRAINSCutWorkflow(projectid,
cutWF.connect(inputsSpec, 'T1Volume', RF12BC, 'inputSubjectT1Filename')

from PipeLineFunctionHelpers import MakeInclusionMaskForGMStructures;
makeCandidateRegionNode = pe.Node(interface=Function(['posteriorDictionary'],
['outputCandidateRegion'],
makeCandidateRegionNode = pe.Node(interface=Function(['posteriorDictionary','candidateRegionFileName'],
['outputCandidateRegionFileName'],
function=MakeInclusionMaskForGMStructures), name="MakeCandidateRegion")
makeCandidateRegionNode.inputs.candidateRegionFileName = "RF12_CandidateRegionMask.nii.gz"
cutWF.connect(inputsSpec,'posteriorDictionary',makeCandidateRegionNode,'posteriorDictionary')
cutWF.connect(makeCandidateRegionNode,'outputCandidateRegion', RF12BC,'candidateRegion')
cutWF.connect(makeCandidateRegionNode,'outputCandidateRegionFileName', RF12BC,'candidateRegion')

if not t1Only:
cutWF.connect(inputsSpec, 'T2Volume', RF12BC, 'inputSubjectT2Filename')
Expand Down

0 comments on commit e165eb8

Please sign in to comment.