| 
					
				 | 
			
			
				@@ -0,0 +1,48 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import slicer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import Elastix 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import CTRegistration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import slicerNetwork 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+configFile = os.path.join(os.path.expanduser('~'), '.EMBRACE','onko-nix.json') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+dataManager = CTRegistration.CTRegistrationLogic(configFile) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+network = slicerNetwork.labkeyURIHandler() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+dataManager.importer.setURIHandler(network) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+elastix = Elastix.ElastixLogic() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+registrationIndex = 17 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    id="par0023" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    modality="3D CT, 3D MR, multimodal" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    content="head and neck" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    description="intrapatient; rigid + B-spline transformation; localized mutual information combined with bending energy penalty" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    publications="Leibfarth (2013),  A strategy for multimodal deformable image registration to integrate PET/MR into radiotherapy treatment planning" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+RegistrationPresets_ParameterFilenames = 5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+['Rigid.txt', 'Deformable.txt'] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+parameterFilenames = elastix.getRegistrationPresets()[registrationIndex][RegistrationPresets_ParameterFilenames] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+transformNode=slicer.vtkMRMLGridTransformNode() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+transformNode.SetName(transformNodeName) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+slicer.mrmlScene.AddNode(transformNode) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+for i in range(0,86): 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    patientID = 'LJU'+'{:03d}'.format(i) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    dataManager.loadData(network,patientID) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    fixedVolumeNode = slicer.util.getFirstNodeByName(patientID+'_DMR') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    movingVolumeNode = slicer.util.getFirstNodeByName(patientID+'_CT') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    transformNodeName = patientID+'_T2_DF' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    elastix.registerVolumes(fixedVolumeNode, movingVolumeNode, parameterFilenames = parameterFilenames, outputVolumeNode = None, outputTransformNode = transformNode, fixedVolumeMaskNode = None, movingVolumeMaskNode = None, forceDisplacementFieldOutputTransform = True) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    dataManager.export(network, 'EMBRACE/Studija', patientID) 
			 |