Comments (5)
Hi, no, it can only work on conform, isotropic images. You can choose a different voxel size, but it needs to be isotropic. Also it is not recommended to map to MNI (or other spaces), to avoid yet another interpolation step.
from fastsurfer.
If you need segmentations to be in the MNI space because some other analysis is performed there and so you want labels to be defined there, there is currently only one possible procedure that is not well-tested (this would also be similar to what you would/could do with FreeSurfer):
- make sure your image is at 1mm isotropic (in MNI-space)
- modify the image to fix the RAS matrix (the matrix needs to be along main directions, ((1 0 0), (0 1 0), (0 0 1)) or ((1 0 0), (0 0 -1), (0 -1 0)) .... or the like.... NOTE: you are intentionally breaking the consistency of RAS-coordinates here.
- run FastSurfer on the image you created --- the output segmentations will be in the same isotropic image space, ...
- copy the segmentation files after the completed run (e.g.
mri/aseg.mgz
and revert your RAS-matrix to what it was before --- this fixes the consistency issue noted in 2. (also note,aseg.mgz
is always stored in LIA, you may need to convert it to RAS or whatever you had in step 2 first.) - Repeat the step 4 for any other segmentation files
I believe this should get you the outputs you wanted... you still should quality-check everything.
from fastsurfer.
As an additional note: the conformation is needed for 2 reasons:
- The network needs isotropic images and the intensity rescaling to 0-255
- The FreeSurfer-based surface pipeline needs images to be stored as LIA (RAS matrix only +-1 or 0).
from fastsurfer.
Thank you very much for the explanation. Here's a quick follow-up question:
Suppose I set a t1w image that is in 1mm MNI space (pixels are isotropic, but the dimensions of the image are 192 * 220 * 192) as the input for fastsurfer, would the conformation step (which results the output image to be 256 * 256 * 256) change voxel sizes (meaning that each voxel would be streched or compressed) or would the voxels remain the same size (1 milimeter squared) as those from the original 1mm MNI space? I set --vox_size as 1. I am mainly using fastsurfer for tissue volume calculations and I am wondering if there needs a conversion.
from fastsurfer.
Hi,
quick answer: it is padding, but voxels size will not be changed again if it is already 1mm isotropic, BUT it will rotate your image.
Just to explain and document this better. FastSurfer follows the FreeSurfer convention (with its advantages and disadvantages).
What the conform step in FreeSurfer (and FastSurfer) does:
- it re-orients the image so that the axes are aligned with the RAS coordinate system (LIA orientation specifically). This is usually a rotation.
- at the same time it re-slices inputs to 1mm isotropic voxels. FastSurfer is a little different here, as it keeps a higher resolution by default if it finds it in the input. FreeSurfer needs a specific hires flag for that and always uses 1mm by default.
- it adjusts image dimension to 256x256x256 (usually by padding) for 1mm and larger cubic images for higher resolutions, to make sure that no part of head is cropped during rotation and re-slicing.
- image intensities are robustly scaled to 0 .. 255, also aiming to normalise WM intensity to around 110
- images are converted to unsigned character data type
This happens to any input image and cannot be switched off. It means, even if your images are already 1mm isotropic, they would still be rotated to the axes (LIA). The only way to prevent it, is to overwrite your image header and pretend that it is already in LIA orientation. Then fix the header again of all outputs. This is a very ugly workaround and can lead to all kinds of issues (e.g. derived surfaces etc are also affected).
We have considered moving away from the FreeSurfer way to allow more flexibility here, but it could have many unintended consequences and will likely produce incompatibilities between FastSurfer and FreeSurfer. It would also require retraining and redesign of all our other deep learning segmentation modules. Lot's of work.
Another workaround could be to not store the hard labels but instead write out the soft-labels (predictions) and map those to the input or talairach space and then convert to hard labels there (this would not help the surface pipeline, but for the segmentation). It would not be optimal but still much better than mapping hard labels with e.g. nearest neighbour interpolation. I am not sure if we have a flag for writing soft labels (which would require a lot disk space), but it could probably be added relatively easily, e.g. as a 4D image stack. We could also have a command line tool that reduces this to a 3D hard segmentation again after mapping. It could even be done in a single step, inside fastsurfer, if requested by the user as we know the original position of your input. We are thinking about these options.
from fastsurfer.
Related Issues (20)
- CC values all 0 in aseg+DKT.stats HOT 5
- input image contains negative values and gpu memory issue HOT 6
- Issue creating symbolic links when running fastsurfer-gpu.sif HOT 6
- Error during smooth_aparc.py mode HOT 1
- Error during smooth_aparc.py mode_filter HOT 5
- Biasfield-corrected image input of the segstats.py HOT 4
- Use of '--rm' argument in build.py results in a TypeError HOT 4
- Is it possible to get segstats of cerebellum after run FastSurfer pipeline? HOT 3
- Some zeros in aseg.stats HOT 8
- Fooocus colab stopping with this error HOT 4
- FastSurfer surf pipeline did not finish: Missing .label files (not enough memory for mris_sample_parc) HOT 11
- conform.py bug HOT 2
- srun_fastsurfer.sh on HPC, surface pipeline fails for hundreds but works for tens of subjects HOT 8
- Question about content of wmparc.DKTatlas.mapped.mgz HOT 1
- Support for lesion masks? HOT 1
- Unmatched ROIs in predicted segmentation and provided FastSurfer_ColorLUT.tsv HOT 23
- FastSurfer QuickSeg doesn't work with OASIS `.img` files HOT 3
- Docker build workflows HOT 5
- Model download issue HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastsurfer.