Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MRIcron as viewer #25

Closed
dorianps opened this issue Mar 12, 2015 · 10 comments
Closed

Add MRIcron as viewer #25

dorianps opened this issue Mar 12, 2015 · 10 comments

Comments

@dorianps
Copy link
Collaborator

Have a viewer (decided for MRIcron) that can be launched from R to view an antsImage.

@muschellij2
Copy link
Collaborator

I think you would want to use the standard plot or orthographic views for this and not an external viewer. This is especially important because you can create reproducible PNGs and PDFs using standard devices and plot().

@bkandel
Copy link
Collaborator

bkandel commented Mar 27, 2015

We already have plot.antsImage, which does basic visualization. The
motivation for going to an external viewer is the possibility of
interactive viewing of images. As far as I can tell, there is no way in R
to interact with an image, which makes it difficult to view a 3D image.

2015-03-27 1:24 GMT-04:00 John Muschelli [email protected]:

I think you would want to use the standard plot or orthographic views for
this and not an external viewer. This is especially important because you
can create reproducible PNGs and PDFs using standard devices and plot().


Reply to this email directly or view it on GitHub
#25 (comment).

@dorianps
Copy link
Collaborator Author

Personally, I have changed my mind on the viewer to integrate for quick visualization. I would go with ITKsnap instead of MRIcron. It has better management of layers, colormaps, changes in transparency, etc. If I would be wanting to see an image with an external viewer, it would probably be to use overlays more than just viewing a single image. MRIcron doesn't even allow to unload a single overlay, or to change the order of overlays, or to set specific transparency+colormap options for each overlay. I think the type of user that will be using ANTsR will appreciate more ITKsnap.

@bkandel
Copy link
Collaborator

bkandel commented Jun 10, 2015

I talked about this with Brian, and we decided against adding it to ANTsR. The main issue is that it introduces an external dependency that will add significant complexity: Maintenance of interface, ability to control the spawned process from R, etc., so it would go too far afield from the core purpose of ANTsR, which is to provide reproducible R-based processing of images.

If you wanted to do this on your own machine, a sample script would look something like:

itksnap <- function(image, overlay=NA) { 
  tempname1 <- paste(tempfile(), '.nii.gz', sep='')
  antsImageWrite(image, tempname1)
  command <- paste('itksnap -g', tempname1)
  if (!is.na(overlay)) {
    tempname2 <- paste(tempfile(), '.nii.gz', sep='')
    antsImageWrite(overlay, tempname2)
    command <- paste(command, '-o', tempname2)
  }
  system(command)
}

You could expand this by adding support for multiple overlays, segmentations, etc.

@bkandel bkandel closed this as completed Jun 10, 2015
@stnava
Copy link
Member

stnava commented Jun 10, 2015

thanks @bkandel

brian

On Wed, Jun 10, 2015 at 3:59 PM, bkandel [email protected] wrote:

Closed #25 #25.


Reply to this email directly or view it on GitHub
#25 (comment).

@dorianps
Copy link
Collaborator Author

As we talked, Shiny can now be used for a similar purpose. Simple interaction with three views.

@bkandel
Copy link
Collaborator

bkandel commented Jun 10, 2015

Yes! That would be better. If you are able to put up a general-purpose
function, that would be helpful.

2015-06-10 16:28 GMT-04:00 dorianps [email protected]:

As we talked, Shiny can now be used for a similar purpose. Simple
interaction with three views.


Reply to this email directly or view it on GitHub
#25 (comment).

@stnava
Copy link
Member

stnava commented Jun 10, 2015

agreed - would be nice to have that documented somewhere ... i recall
sending an example but doubt it's archived appropriately

brian

On Wed, Jun 10, 2015 at 4:30 PM, bkandel [email protected] wrote:

Yes! That would be better. If you are able to put up a general-purpose
function, that would be helpful.

2015-06-10 16:28 GMT-04:00 dorianps [email protected]:

As we talked, Shiny can now be used for a similar purpose. Simple
interaction with three views.


Reply to this email directly or view it on GitHub
#25 (comment).


Reply to this email directly or view it on GitHub
#25 (comment).

@muschellij2
Copy link
Collaborator

Just FYI - We have tried this to some degree.

You can try papayar (https://github.com/muschellij2/papayar), which is based on Papaya/Mango (https://github.com/rii-mango/Papaya/).

devtools::install_github("muschellij2/papayar")
library(papayar)
URL <- "http://nifti.nimh.nih.gov/nifti-1/data/zstat1.nii.gz"
urlfile <- file.path(tempdir(), "zstat1.nii.gz")
download.file(URL, dest=urlfile, quiet=TRUE)
papaya(urlfile)

Then if you change the windowing to [0, 10] and see the image.

You can also use itksnapr (https://github.com/muschellij2/itksnapr):

devtools::install_github("muschellij2/itksnapr")
library(itksnapr)
URL <- "http://nifti.nimh.nih.gov/nifti-1/data/zstat1.nii.gz"
urlfile <- file.path(tempdir(), "zstat1.nii.gz")
download.file(URL, dest=urlfile, quiet=TRUE)
itksnap(urlfile)

@dorianps
Copy link
Collaborator Author

Papaya did not work for me in the cluter, requires safari which is not there.

ITKsnap solution looks great and worked right away. It just needs a tiny change to accept antsImage class. If input is antsImage, save it to temp folder, then call itksnap. I would also suggest to keep -g background and -o overlays as separate arguments instead of expecting them together in a list.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants