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

error in fslr function #27

Open
troywty opened this issue Jun 24, 2021 · 5 comments
Open

error in fslr function #27

troywty opened this issue Jun 24, 2021 · 5 comments

Comments

@troywty
Copy link

troywty commented Jun 24, 2021

Hello John,
I am working on a project to do defacing, for which your library is being used in my script.
We have used your library without any error for several months since we installed it.
However, a following error suddenly recently appears when I run functions such as fslsmooth and CT_Skull_Strip_robust in fslr, even if fslr is sucessfully loaded in R.

smooth = fslsmooth(thresh.img, sigma = 0.5, retimg=TRUE)#sigma value to control to be soother

fslmaths "/tmp/Rtmpz4mcgw/file3897145cb153.nii.gz" -s 0.5 "/tmp/Rtmpz4mcgw/file389710b12b8f";

Error in (function (fname, onefile = TRUE, gzipped = TRUE, verbose = FALSE, :
Not all data was read in: should be length 34078720 but only 32156 was read in!

Do you know why this error occurs and how should I fix it?
Are there any requirements for installing particular versions of associated R packages to avoid this error in fslr?
Any advice will be great help!
Thanks,
Tingyu

@troywty troywty changed the title DICOM read in error error in fslr function Jun 24, 2021
@muschellij2
Copy link
Owner

If you have a question, please provide a MCVE: https://stackoverflow.com/help/mcve. In any example, I recommend using a reproducible example using the reprex package (https://github.com/tidyverse/reprex). Also, please include a sessioninfo::session_info() output.

@troywty
Copy link
Author

troywty commented Jun 24, 2021

Hi, thank you for replying so quickly. Here is an example of fslr that addresses the same error. The session info is attached as a txt.

library(fslr)
if (have.fsl()){
system.time({
dims = c(50, 50, 20)
x = array(rnorm(prod(dims)), dim = dims)
img = nifti(x, dim= dims,
datatype = convert.datatype()$FLOAT32, cal.min = min(x),
cal.max = max(x), pixdim = rep(1, 4))
s.img = fslsmooth(img, retimg=TRUE)
})
}
fslmaths "/tmp/RtmpLA9Qtd/file3acd1a3e0df9.nii.gz" -s 10 "/tmp/RtmpLA9Qtd/file3acd7935f068";
Error in (function (fname, onefile = TRUE, gzipped = TRUE, verbose = FALSE, :
Not all data was read in: should be length 50000 but only 2213 was read in!
Timing stopped at: 0.233 0.034 0.264

sessionInfo.txt

@muschellij2
Copy link
Owner

muschellij2 commented Jun 24, 2021

Sorry, but I can't reproduce that error. That error is coming from oro.nifti::readNIfTI I think. Can you try to run the command
fslsmooth(img, retimg = FALSE, outfile = "myfile.nii.gz") and then run readniii("myfile.nii.gz")? Also, can you view myfile.nii.gz in FSL? Please see the reprex package for future reproducible examples.

@troywty
Copy link
Author

troywty commented Jun 24, 2021

Hello John, I tried what you suggested, but here is the similar error again.

image

We tried to view the input image generated by the example code in fslr, here is the capture of the image.
image

Because of the error in the reading of the nifty image, fslview("myfile.nii.gz") does not display anything.

Thanks for your timely help! Do you have any suggestions to resolve this issue?

@muschellij2
Copy link
Owner

muschellij2 commented Jun 24, 2021 via email

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

2 participants