KitwareMedical / otm-server

Apache License 2.0
0 stars 2 forks source link

Add step to UTM code to write out analysis images as nifti #112

Closed ebrahimebrahim closed 2 years ago

ebrahimebrahim commented 2 years ago

This issue will be closed by a PR on https://github.com/kitwaremedical/utm

We see here in the Rshiny app that what we want is the data that gets written to cor-vbm-utm.Rdata.

Assuming RNifiti is installed (see #111), here is a code snippet that worked for me when testing out writing an image as nifti:

library(RNifti)
load('cor-vbm-utm.Rdata') # From within UTM analysis results directory, where `'cor-vbm-utm.Rdata'` was saved.
img = cor.res[[1]]$im$allocation # an example img to work with
writeNifti(img, 'example_nifti.nii.gz') # IDK if it compresses it when we use gz in extn, but this did work for me

We want to write out cor.res[[j]]$name (string), cor.res[[j]]$im$allocation (nifti), cor.res[[j]]$pim$allocation (nifti), cor.res[[j]]$im$transport (nifti), cor.res[[j]]$pim$transport (nifti), cor.res[[j]]$im$vbm (nifti), cor.res[[j]]$pim$vbm (nifti).

We probably want to do that just before or after this line.

See RNifti documentation here.

ebrahimebrahim commented 2 years ago

Closed by https://github.com/KitwareMedical/UTM/pull/5 and https://github.com/KitwareMedical/UTM/pull/7