You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpydeform# Read a volumevolume=pydeform.read_volume('image.nrrd')
# Creates a copy of the image dataarray1=np.array(volume)
# Reference to image data, enabling editing of 'img' objectarray2=np.array(volume, copy=False)
array2[0,0,0] =1# Create a new Volume object, for input to registration:new_volume=pydeform.Volume(
array1,
origin=volume.origin,
spacing=volume.spacing
)
# ...pydeform.register(volume, new_volume)
Regularization weight map:
importpydeformsettings= {
'step_size': 0.2
}
fixed=pydeform.read_volume('fixed.nrrd')
moving=pydeform.read_volume('moving.nrrd')
# Retrieve fixed image datafixed_data=np.array(fixed)
# Create a regularization mapregmap=pydeform.Volume(
(fixed_data>0.5)*0.5, # Only regularize voxels with intensities larger than 0.5
)
# Don't forget meta dataregmap.copy_meta_from(fixed)
# Perform registrationdf=pydeform.register(
fixed,
moving,
regularization_map=regmap,
settings=settings
)
pydeform.write_volume('result.nrrd', df)
No description provided.
The text was updated successfully, but these errors were encountered: