Closed manuegrx closed 6 months ago
done: add bricks to extract ROI from a segmented and labelled image, to extract signal from ROI and to plot the signal and a snapshot of a ROI (see https://github.com/populse/mia_processes/commit/0287d18dd25d79fe37960d767c61aa05e73a873c ) .
Regarding the brick to launch directly the Assemblynet docker in MIA, it works well by launching directly docker using subprocess in run_process_mia
(see branch https://github.com/populse/mia_processes/tree/test_docker ).
Of course, docker should be available (for example it is not working in casa_distro ) and so this raises questions about how to check the availability of Docker and make it work on Linux, Mac and windows.
I guess running Docker directly in run_process_mia
is not very elegant and if we decide to go further, it would be better to add a Docker module in capsul or something like that (or not if it is only for one Docker..)
@servoz what do you think about run docker inside MIA ?
I think it can be very useful to be able to run Docker images inside MIA when they are performing only one "action" (for example for Assemblynet make whole brain segmentation) and when they do not required BIDS data as input and when the outputs are well defined.
I think that Docker images that are "one big pipeline" using others software (like MRIQC or fMRIPrep) may be outside the scope of MIA
@servoz what do you think about run docker inside MIA ?
In fact, I don't really have any ideas on the subject. It may cause problems with remote calculation ... or not!!!! Why not!!!
Docker may be a problem in some contexts such as computing centers. This is why we did not make effort to call it from casa-distro container. However, one can call apptainer
from casa-distro. It is very simple to create an apptainer image from a DockerHub hosted image. For instance, if I had to try AssemblyNet with apptainer, I would start with something like that:
apptainer build --disable-cache AssemblyNet.sif docker://volbrain/assemblynet:1.0.0
apptainer run -B /absolute/path/to/images:/data AssemblyNet.sif <a command>
I did not try it myself, I just tried the first line while writing and it seems to be very long (is AssemblyNet huge ?), but people in CATI have tried AssemblyNet (I do not know if it was through apptainer). In Docker images, there can be an embedded command that is run when you simply run the image. This is why you do not give command while running AssemblyNet image with Docker. There is something equivalent with apptainer but I do not know if the image conversion makes the link between the two systems. If the AssemblyNet doc do not allow to find out what command to run, a little bit of reverse engineering on the Docker image may be necessary.
By the way, there is a process in BrainVISA that does something similar to what you want. For the "scalar features", there are also tools such as AimsRoiFeatures
that extract simple statistics from images and ROIs (min, max, mean, standard deviation and median). It had been done a loooong time ago so I do not know if you can find something that you can use in it. If you think it could be interesting to look at it, I can help.
To complement my previous comment. The final AssemblyNet.sif
is a 17 Go file (quite huge !) but it seems to be able to be run out of the box:
$ apptainer run AssemblyNet.sif -h
usage: assemblyNetPipeline.py [-h] [-recursive] [-no-pdf-report] [-global-csv GLOBAL_CSV] [-sex SEX] [-age AGE] [-age-sex-csv AGE_SEX_CSV] [-pattern-t1 PATTERN_T1] [-batch-size BATCH_SIZE]
filenames [filenames ...]
AssemblyNet public version
positional arguments:
filenames "T1_filename [T1_filenames] [output_dir]" or "T1_input_dir [output_dir]"
optional arguments:
-h, --help show this help message and exit
-recursive search files recursively in input_dir according to patternT1
-no-pdf-report do not output the pdf report of each T1 image
-global-csv GLOBAL_CSV
output a global csv filename instead of a csv filename for each T1 image
-sex SEX specify sex of subject on input T1 image, as "female" or "male"
-age AGE specify age in years of subject on input T1 image
-age-sex-csv AGE_SEX_CSV
input csv filename with age and sex for all input T1 images
-pattern-t1 PATTERN_T1
pattern to search T1 image filenames with in input_dir (default: *.nii*)
-batch-size BATCH_SIZE
batch size of T1 images processed simultaneously (default: 3)
If you need to use GPU and have an NVIDIA card, you can use apptainer run --nv AssemblyNet.sif ...
.
Yes Assemblynet is quite huge (30.8GB for the docker image) !
Ok so depending on how it is used (on a local computer without casa with Docker already install / on a local computer with casa_distro / on a computing centers) it will be useful to use either apptainer or Docker .. It seems quite hard to chose one without knowing the context in which it will be used..
I think I will do a specific brick for Docker (at the moment it's something I could use) and be specific in the name and the documentation that Docker is needed And if there is a needed to use this in casa_distro and/or on a computing centers I can make an other brick for apptainer @servoz seems okay for you ? (as for the Matlab brick it will be a little bit experimental, as the check about Docker availability will be done in the run part and not during initialization ...)
And thanks @sapetnioc for the BrainVISA process I will have a look on it !
OK for me.
The idea is to create a pipeline (I think in the qualityControl folder) to obtain the average signal of an image in selected regions of interest for each volume of a 4D image and to obtain a quick report (in a first time, a .png image should be enough) like this :
At least the following bricks should be create:
I would like to used the ROI of the brain segmentation obtained with AssemblyNet. I will try to create a brick to launch directly the docker in MIA. If it works and if it seems useful to investigate this possibility, it will probably necessary to add some requirement to check if docker is available. It will probably also useful to have a brick to convert number label into ROI names.