Code Monkey home page Code Monkey logo

Comments (13)

zswgzx avatar zswgzx commented on August 11, 2024 1

Got it Leonie, that's very helpful. Let me try and I'll close if I don't have any other issue. Nice work!

from fastsurfer.

m-reuter avatar m-reuter commented on August 11, 2024 1

Currently FastSurfer does not support re-running parts of the pipeline, but it is on the to-do list.

from fastsurfer.

zswgzx avatar zswgzx commented on August 11, 2024

Some other messages:

eval.py:376: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  aseg_lh = gaussian_filter(1000 * np.asarray(pred_prob == 2, dtype=np.float), sigma=3)
eval.py:377: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  aseg_rh = gaussian_filter(1000 * np.asarray(pred_prob == 41, dtype=np.float), sigma=3)

from fastsurfer.

LeHenschel avatar LeHenschel commented on August 11, 2024

Hey,

if you add the --fsaparc flag to the run command, the other default FreeSurfer atlases should be segmented as well. These are skipped by default (--> DKTatlas from the DL prediction is used which is faster).

./run_fastsurfer.sh --t1 /your/input/image.nii.gz --sd /your/output/dir --sid YourSubjectID --fsaparc

Best,
Leonie

from fastsurfer.

zswgzx avatar zswgzx commented on August 11, 2024

Thank you @LeHenschel . Just curious if DKTatlas would be the only version for output with adding -fsaparc as considering other default FS atlases? So for example, would a2009s labels be included also for the updated output with the -fsaparc option?

Btw, does fast surfer output the full folder structures for segmentation only, e.g. label or stats, as generated by Freesurfer?

Thanks again! Shengwei

from fastsurfer.

m-reuter avatar m-reuter commented on August 11, 2024

Hi, with -fsaparc you should get all the FS atlas versions. Also FastSurfer does output full folder structure. It is missing only a few intermediate files which are not required for our processing steps.

from fastsurfer.

zswgzx avatar zswgzx commented on August 11, 2024

Thank you professor @m-reuter for the update. Would you mind providing more detailed usage as such? Below was the command tried:

cd $fastsurfer
./run_fastsurfer.sh --t1 $t1.nii.gz --sid $id --sd $dest --py python --seg_only --parallel --fsaparc

I only got $dest/{mri,scripts} and only aparc.DKTatlas+aseg.deep.mgz & deep-seg.log. Ideally a full FS folder structure with $dest/{label, stats, ...} folders would be expected, and aparc.a2009s+aseg.deep.mgz would be expected in folder $dest/mri. Are they achievable and how? Thanks again!

from fastsurfer.

LeHenschel avatar LeHenschel commented on August 11, 2024

Hey Shengwei,

the fsaparc flag only takes effect if you run the entire fastsurfer pipeline (including recon-surf). The --seg_only flag only runs the DL prediction which is limited to the DKTatlas.

So regarding your inital question

Btw, does fast surfer output the full folder structures for segmentation only, e.g. label or stats, as generated by Freesurfer?

  1. No, with the --seg_only you only get the segmentation (so what you observed: mri/aparc.DKTatlas+aseg.deep.mgz and scripts/deep-seg.log)

  2. You can potentially extract the volume stats already from the segmentation (only for the DKTatlas). However, in FreeSurfer the workflow here also considers some partial volume corrections via the norm.mgz etc. Hence, so far we only include the option to get the stats volume outputs after the norm.mgz has been generated. You can run this part only (without the surfaces) by adding the --vol_segstats flag:

    • From the help:
      --vol_segstats Additionally return volume-based aparc.DKTatlas+aseg statistics for DL-based segmentation (does not require surfaces). Can be used in combination with --seg_only in which case recon-surf only runs till CC is added (akin to --seg_with_cc_only)."
    • Your command would look like this:
cd $fastsurfer
./run_fastsurfer.sh --t1 $t1.nii.gz --sid $id --sd $dest --py python --seg_only --vol_segstats --parallel --fsaparc
  1. For the $id/labels folder and the other atlas segmentations you need to run the entire pipeline, because these are based on the surfaces (which will be generated in the recon-surf part). The a2009s segmentation also requires you to run the entire pipeline.

    So in this case, your command would look like this:

cd $fastsurfer
./run_fastsurfer.sh --t1 $t1.nii.gz --sid $id --sd $dest --py python --parallel --fsaparc

Hope this helps.

Best,
Leonie

from fastsurfer.

zswgzx avatar zswgzx commented on August 11, 2024

One more question as I'm running it on a Azure VM (6 cpus w/ 56G RAM): does the --thread option only affect the surface pipeline? Setting up the OMP/ITK threads could accelerate the processing time if I understand correctly. But how should I choose? My final goal is to dockerize it for a pre-selected VM size, so I can scale it to a larger population.

from fastsurfer.

m-reuter avatar m-reuter commented on August 11, 2024

Note that the full pipeline is of course much longer than the 1 minute (GPU) for segmentation. If you run purely CPU also the segmentation will be much slower (like around 30 mins or longer).
About the --thread option, it only affects the recon_surf pipeline, so basically all FreeSurfer executables that can do parallel processing. Not sure which these are but with 6 CPUs you should definitely try to run in parallel, maybe try 6 and you can run both hemispheres in parallel (--parallel flag).

from fastsurfer.

zswgzx avatar zswgzx commented on August 11, 2024

I see, will try using as many threads as the number of cpus. And I'm trying it on a GPU VM so it does run FAST! Another question, hopefully the last, that comes to mind is that should I re-run if there's any manual correction(s) made? FS has some flags for re-running recon-all after correction on WM/pial/talairach transformation etc. Would re-running fastsurfer consider any updates to the corrected file(s)? Thanks for the update!

from fastsurfer.

zswgzx avatar zswgzx commented on August 11, 2024

Just finished my trial for the full pipeline with just one thread. And the outputs resemble the FS ones so I guess it runs well.

One thing I noticed was that the aparc.a2009s+aseg.mgz was still missing (this was what we've been using throughout the analyses) but the corresponding label/annot & stats existed. Would it be possible to generate the actual segmentation image from the existing outputs? Thanks!

from fastsurfer.

m-reuter avatar m-reuter commented on August 11, 2024

Great. The easiest would be to run recon_all from FreeSurfer with the -aparc2aseg flag. It will create those files. See here for the command it uses: https://github.com/freesurfer/freesurfer/blob/b28bb9591cb2de638f3bc560d41cf4f4e13b815a/scripts/recon-all#L4601
So if you want only one of those files, run this one time, look at the log file and copy the exact command for the left and right hemisphere. Not sure why we don't create those. Maybe it is (or was) not part of the stream in FS 6.0 .

from fastsurfer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.