Код Python:
Код: Выделить всё
import itk
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.ndimage import rotate
import scipy.ndimage as ndi
import ipywidgets as widgets
from ipywidgets import interact, IntSlider
import time
## Merge CT from patient XXXX and targets from YYYY
os.chdir('C:/Users/Admin/OneDrive - UPV/Documentos/UMIL/problemas neurho/AutoCorregistration/Testing')
print("Hola0")
nr = '0000'
MRh = itk.imread("NIIFT/MRI_"+nr+".nii", itk.F)
CTh = itk.imread("NIIFT/CT_"+nr+".nii", itk.F)
print("Test1")
fixed_image = CTh
resize_factor = 1
moving_image = MRh
print("Test2")
parameter_object = itk.ParameterObject.New()
parameter_object.ReadParameterFile("ParametersRigid.txt")
print("Test3")
Код: Выделить всё
result_image, rigid_parameters = itk.elastix_registration_method(
fixed_image, moving_image,
parameter_object=parameter_object,
log_to_console=False)
print(parameter_object)
print("Test4")
itk.imwrite(result_image, "NIIFT/MRI_Corr_"+nr+".nii")
print("Test5")
Код: Выделить всё
pyrunfile("Merger_CT_X_TARGET_Y.py");
Код: Выделить всё
>> MergeFromMatlab
Test0
Test1
Test2
Test3
(...some prints here)
Error using py.exec
Python process terminated unexpectedly. To restart the Python interpreter, first call "terminate(pyenv)" and then call a Python function.
Error in MergeFromMatlab (line 3)
pyrunfile("Merger_CT_X_TARGET_Y.py");
Подробнее здесь: https://stackoverflow.com/questions/793 ... -pyrunfile
Мобильная версия