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
To limit image generation and maximize image translation, preprocessing steps are applied to the input data to ensure a common field of view (fov) between the image.
Note: Having different fov between contrasts is not exceptional, indeed due the different image protocols this is often the case
Example with the subject sub-balgrist01 from spinegeneric with the two contrasts T1w and T2w
Note: We can also notice a difference between the defacing boxes that were used for the two contrasts
To ensure a similar image coverage, arrays full of ones were generated for each original contrast, then after registration of the source contrast (here T2w) and the corresponding array full of ones to the destination contrast (here T1w) the two arrays full of ones (registered T2w and original T1w) were multiplied to create the intersection of the field of views. This intersection was then used to crop the two images. You can find a commented version of the code below:
code
# Set image orientation to RSPout=subprocess.run(['sct_image',
'-i', in_path,
'-setorient', 'RSP'])
out=subprocess.run(['sct_image',
'-i', dest_path,
'-setorient', 'RSP'])
# Create a coverage mask with ones to find the shared fovout=subprocess.run(['sct_create_mask',
'-i', in_path,
'-o', in_ones,
'-size', '500',
'-p', 'center'])
out=subprocess.run(['sct_create_mask',
'-i', dest_path,
'-o', dest_ones,
'-size', '500',
'-p', 'center'])
# Register input_image to destination_imageout=subprocess.run(['sct_register_multimodal',
'-i', in_path,
'-d', dest_path,
'-identity', '1',
'-x', 'nn',
'-o', in_reg_path,
'-owarp', for_warp_path,
'-owarpinv', inv_warp_path])
# Bring coverage to destination spaceout=subprocess.run(['sct_apply_transfo',
'-i', in_ones,
'-d', dest_path,
'-w', for_warp_path,
'-x', 'linear',
'-o', in_ones_reg])
# Multiply fovs to extract the shared fov between the 2 imagesout=subprocess.run(['sct_maths',
'-i', dest_ones,
'-mul', in_ones_reg,
'-o', mask_path])
# Crop registered contrastout=subprocess.run(['sct_crop_image',
'-i', in_reg_path,
'-m', mask_path,
'-o', input_crop_path])
# Crop dest contrastout=subprocess.run(['sct_crop_image',
'-i', dest_path,
'-m', mask_path,
'-o', dest_crop_path])
But unfornately, sct_crop_image is not acting as expected and only maximum coordinate of the mask are kept.
To fix this, I will then multiply both images with the shared fov mask before cropping. To set all the non-shared pixel to zero.
The text was updated successfully, but these errors were encountered:
Description
To limit image generation and maximize image translation, preprocessing steps are applied to the input data to ensure a common field of view (fov) between the image.
Example with the subject
sub-balgrist01
from spinegeneric with the two contrasts T1w and T2wTo ensure a similar image coverage, arrays full of ones were generated for each original contrast, then after registration of the source contrast (here T2w) and the corresponding array full of ones to the destination contrast (here T1w) the two arrays full of ones (registered T2w and original T1w) were multiplied to create the intersection of the field of views. This intersection was then used to crop the two images. You can find a commented version of the code below:
code
But unfornately,
![Kapture 2024-05-28 at 13 43 54](https://private-user-images.githubusercontent.com/68945192/334518015-c6224f8c-5f3f-490b-ad00-69d2f74b6759.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5NzkwMjcsIm5iZiI6MTczOTk3ODcyNywicGF0aCI6Ii82ODk0NTE5Mi8zMzQ1MTgwMTUtYzYyMjRmOGMtNWYzZi00OTBiLWFkMDAtNjlkMmY3NGI2NzU5LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDE1MjUyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxMDA0YTBkZGJiMzQxYzA2MDczNzI3MmNjZjliYzQzZmEzODlmZDcyNmZmMTdjZGY3MTUwMzIwOTMwYmM2YzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Q9bn3LXcAYS44yFB_hBi6cw0aSACWffMruaT3oaPlfw)
sct_crop_image
is not acting as expected and only maximum coordinate of the mask are kept.To fix this, I will then multiply both images with the shared fov mask before cropping. To set all the non-shared pixel to zero.
The text was updated successfully, but these errors were encountered: