Mouse-Imaging-Centre / MRIcrotome

R package for MRI data visualization
3 stars 1 forks source link

Feature Request: contours() to work for labels #11

Open nzxwang opened 4 years ago

nzxwang commented 4 years ago

I'm not sure if we already have a good way to do this, but I haven't been able to find one yet. It would be nice to be able to display an anatomical image with overlayed contours calculated from the atlas registered to the respective image (or the image registered to the atlas). For example, If I am interested in seeing how well the hippocampus from the LSQ6 image registered to the MAGeT atlas:

sliceSeries(nrow = 4, ncol = 1, begin = 110, end=200) %>%
anatomy(volume = anatomy_in_atlas_space, low = min(anatomy_in_atlas_space), high = max(anatomy_in_atlas_space)) %>%
contours(volume = atlas_in_atlas_space, label_levels = hippocampus_labels)

where hippocampus_labels is a vector of all the labels of the hippocampal region.

My current hacky solution is to set all non-hippocampal values of atlas_in_atlas_space to a certain value, and set all hippocampal values to another value and set the levels argument to be a value between the two.

nzxwang commented 4 years ago

original runs: 20s for 5 images, 53s for 10 images, 169s for 20 ~5400s for 134 images

having removed the round and replace: 8s for 5 images, 18s for 10 images 82s for 20

having further removed contours() entirely: 17s for 10 images

It seems that this problem is independent of rounding/replacing and contours(). MRIcrotome's sliceSeries() is n^2 in the number of slices which becomes a problem for hundreds of images