Skip to content

MNI Registration changes real volumes #1645

Answered by cookpa
qwang0225 asked this question in Q&A
Discussion options

You must be logged in to vote

For labels in the fixed space, if you want label volume in the moving space, you can binarize the label, warp to the moving space, and then sum up the values. Something like:

unique_labels = fixed_labels.numpy().unique()
volumes = {}

for label in unique_labels:
    if label == 0:  # Skip background
        continue

    # Create a binary image for the current label
    label_image = ants.threshold_image(fixed_labels, low=label, high=label, inval=1, outval=0)

    # Warp the label image to the moving space using inverse transforms
    warped_label_image = ants.apply_transforms(fixed=moving_image, moving=label_image,      
        transformlist=transform['fwdtransforms'][0], whichtoinvert …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@qwang0225
Comment options

@cookpa
Comment options

@qwang0225
Comment options

@cookpa
Comment options

Answer selected by qwang0225
@qwang0225
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants