Open chriskisskiss opened 1 year ago
Hey.
This originated in the freesurfer R package, not from this package it self. I'm not the best to answer why its sourced, but from my experience, its very much needed to make the freesurfer functions be available to your R session to call upon.
https://github.com/muschellij2/freesurfer/blob/master/R/mri_convert.R
@muschellij2 I dont know if you might have some illuminating input into why this would not work on Ubuntu?
You're quoting freesurfer::fs_subj_dir()
instead of using the code itself. Can you try:
aseg2 <- make_volumetric_ggseg(
label_file = file.path(freesurfer::fs_subj_dir(), "fsaverage5", "mri/aseg.mgz"),
vertex_size_limits = c(10, NA)
)
ah @muschellij2 thanks for seeing that! I didnt notice the quotation marks.
Hi all,
First I want to say thanks for making this package.
Second, I am trying to create a 3d subcortical atlas used the aseg2_3d command, following instructions here
aseg2_3d <- make_volumetric_2_3datlas(
subject = "fsaverage5",
subjects_dir = freesurfer::fs_subj_dir(),
template = "/home/mrspecial/Documents/atlases/tian2020/nifty/Tian_Subcortex_S2_3T.fs5.mgz",
color_lut = "/home/mrspecial/Documents/atlases/tian2020/nifty/Tian2020ColorLUT.txt",
output_dir = "/home/mrspecial/Documents/atlases/tian2020/3d"
)
Aslo get an sh: 1: source: not found error, using Ubuntu 22.04.3 LTS and R 4.3.2
Not using any quotations
Did this run? The source
not found isnt' an error necessarily.
Can you try options(freesurfer_source_function = ".")
and rerun?
It did not run, here is the error message I get, even after adding the suggested option:
Error in 1:dim(plys)[2] : argument of length 0 In addition: Warning message: In mclapply(seq_len(n), do_one, mc.preschedule = mc.preschedule, : 33 function calls resulted in an error
Looking at the output directory, surf
has 66 items, a _filled.mgz + _notsmooth file for each parcel (I'm assuming), but ply
and ascii
are empty.
I have a kind of full January already, but I'll try diving into this asap. Any chance you can provide the mgz and lut for me, so I have the same data to test on?
Thank you! Sure, attached. Tian.zip
FYI, here is the python code I used to make the .mgz (ANTsPy)
import ants
source = ants.image_read('Tian_Subcortex_S2_3T.nii.gz')
target = ants.image_read('/freesurfer/subjects/fsaverage5/mri/T1.mgz')
mytx = ants.registration(fixed=target, moving=source, type_of_transform = 'Rigid')
tianfsaverage5 = ants.apply_transforms(fixed=target, moving=source, transformlist=mytx['fwdtransforms'], interpolator='nearestNeighbor')
ants.image_write(tianfsaverage5, 'Tian_Subcortex_S2_3T.fs5.nii.gz')
Then using freesurfer:
mri_convert Tian_Subcortex_S2_3T.fs5.nii.gz Tian_Subcortex_S2_3T.fs5.mgz
Original atlas file can be found here.
Hello,
when calling
I get
Obviously, sh doesn't know the source command - but why is sh used? in FreeSurferEnv.sh first line is #!/bin/bash -p. System: Ubuntu 22 running newest RStudio Server.
Thank you very much!