alibaba-damo-academy / self-supervised-anatomical-embedding-v2

MIT License
53 stars 5 forks source link

Incorrect spacing when writing sim_map to disk #7

Open samokhinv opened 9 months ago

samokhinv commented 9 months ago

Hi, I am using your tools.demo* and noticed following read_image from tools.utils returns as a third element a ratio instead of spacing of the normalized image This output is passed as norm_info further, and eventually used to set spacing for dumped images.

aa1234241 commented 9 months ago

Hello, take demo.py as an example. If you set the write_sim=True in pt2_normed, score = get_sim_embed_loc(emb1, emb2, pt1_normed, (im2['shape'][3], im2['shape'][1], im2['shape'][2]), norm_info=norm_info_2, write_sim=True, use_sim_coarse=True). This will generate an img.nii.gz file as well as its similar map file sim_map.nii.gz.

Screen Shot 2024-02-26 at 11 54 28 PM

Yes, the spacing is not the same as the normed image input to the model, but they have the same aspect ratio, which is enough for visualization purposes.

single point template-query matching

Screen Shot 2024-02-26 at 11 57 42 PM

correspond similarity map sim_map.nii.gz and the output query img.nii.gz

Screen Shot 2024-02-26 at 11 56 48 PM