Coder Social home page Coder Social logo

gtaberna / mrtim Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 29.98 MB

MR-TIM: MR-based head tissue modelling

Home Page: https://github.com/gtaberna/mrtim/wiki

MATLAB 100.00%
mri mri-images mri-segmentation tissue-models tissue-classification eeg-analysis neuroinformatics

mrtim's Introduction

MR-TIM_logo


MR-TIM: MR-based head tissue modelling is open source MATLAB software for head tissue modelling from structural magnetic resonance (MR) images.

It performs automated segmentation of whole-head T1-weighted MR images in 12 tissues:

  • brain gray matter (GM)
  • cerebellar GM
  • brain white matter (WM)
  • cerebellar WM
  • brainstem
  • cerebrospinal fluid (CSF)
  • spongy bone
  • compact bone
  • muscle
  • fat
  • eyes
  • skin


MR-TIM requires MATLAB 2016b (MathWorks) or later versions and it is intended as a toolbox for SPM12 software package.

To install and use the software, read the user guide.


MR-TIM_icon

mrtim's People

Contributors

gtaberna avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

ipsych mfkiwl

mrtim's Issues

Erroneous and missing masks

Hi,
I just came across your paper and decided to try MR-TIM for my new project.
I followed the instructions and ran the pipeline on a T1w with voxels of 1x1x1mmยณ. The only difference is that I directly installed MR-TIM inside the my /path/to/spm12/toolbox/ directory because I want to be able to build a standalone including your toolbox (to run my whole pipeline on HPC).

Here is the content of the job file I used:

matlabbatch{1}.spm.tools.spm_mrtim.run.anat_image = ...
    {'/path/to/in/sub-04146_run-2_T1w.nii,1'};
matlabbatch{1}.spm.tools.spm_mrtim.run.output_folder = {'/path/to/out'};
matlabbatch{1}.spm.tools.spm_mrtim.run.prepro.res = 1;
matlabbatch{1}.spm.tools.spm_mrtim.run.prepro.smooth = 1;
matlabbatch{1}.spm.tools.spm_mrtim.run.prepro.biasreg = 0.001;
matlabbatch{1}.spm.tools.spm_mrtim.run.prepro.biasfwhm = 30;
matlabbatch{1}.spm.tools.spm_mrtim.run.prepro.lowint = 5;
matlabbatch{1}.spm.tools.spm_mrtim.run.tpmopt.tpmimg = ...
    {'/path/to/MRTIM/external/NET/template/tissues_MNI/eTPM12.nii,1'};
matlabbatch{1}.spm.tools.spm_mrtim.run.tpmopt.mrf = 1;
matlabbatch{1}.spm.tools.spm_mrtim.run.tpmopt.cleanup = 1;
matlabbatch{1}.spm.tools.spm_mrtim.run.segtiss.gapfill = 1;
matlabbatch{1}.spm.tools.spm_mrtim.run.segtiss.tiss_mask = 1;

During the process, I only got the following warning (I also join a full copy of the logs):

::: MR-TIM :::   STEP 2/3 - Tissue probability mapping...
Warning: Name is nonexistent or not a directory:
/path/to/spm12/toolbox/MRTIM/external/NET/net.p 
> In path (line 109)
  In addpath (line 86)
  In net
  In spm_mrtim_segment_sMRI
  In spm_mrtim_run
  In cfg_run_cm (line 26)
  In cfg_util>local_runcj (line 1717)
  In cfg_util (line 972)
  In cfg_ui>MenuFileRun_Callback (line 710)
  In gui_mainfcn (line 95)
  In cfg_ui (line 53) 
performing first normalization step...
๐Ÿ“Ž MR-TIM full logs (click to deploy)
------------------------------------------------------------------------
28-Apr-2021 13:42:50 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:42:50 - Running 'Run'
::: MR-TIM :::   STEP 1/3 - Image pre-processing...


------------------------------------------------------------------------
28-Apr-2021 13:42:55 - Running job #2
------------------------------------------------------------------------
28-Apr-2021 13:42:55 - Running 'Coregister: Estimate'

SPM12: spm_coreg (v7320)                           13:42:55 - 28/04/2021
========================================================================
Completed                               :          13:43:35 - 28/04/2021
28-Apr-2021 13:43:35 - Done    'Coregister: Estimate'
28-Apr-2021 13:43:35 - Done

Direct calls to spm_defauts are deprecated.
Please use spm('Defaults',modality) or spm_get_defaults instead.


------------------------------------------------------------------------
28-Apr-2021 13:43:37 - Running job #2
------------------------------------------------------------------------
28-Apr-2021 13:43:37 - Running 'Segment'

SPM12: spm_preproc_run (v7670)                     13:43:37 - 28/04/2021
========================================================================
Segment /path/to/out/rsanatomy.nii,1
Completed                               :          13:54:08 - 28/04/2021
28-Apr-2021 13:54:08 - Done    'Segment'
28-Apr-2021 13:54:08 - Done

::: MR-TIM :::   STEP 2/3 - Tissue probability mapping...
Warning: Name is nonexistent or not a directory:
/path/to/spm12/toolbox/MRTIM/external/NET/net.p 
> In path (line 109)
  In addpath (line 86)
  In net
  In spm_mrtim_segment_sMRI
  In spm_mrtim_run
  In cfg_run_cm (line 26)
  In cfg_util>local_runcj (line 1717)
  In cfg_util (line 972)
  In cfg_ui>MenuFileRun_Callback (line 710)
  In gui_mainfcn (line 95)
  In cfg_ui (line 53) 
performing first normalization step...


------------------------------------------------------------------------
28-Apr-2021 13:54:11 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:54:11 - Running 'Old Normalise: Estimate & Write'
Smoothing by 8 & 8mm..
Coarse Affine Registration..
Fine Affine Registration..
Saving Parameters..

SPM12: spm_write_sn (v4878)                        13:54:20 - 28/04/2021
========================================================================
Completed                               :          13:54:23 - 28/04/2021
28-Apr-2021 13:54:23 - Done    'Old Normalise: Estimate & Write'
28-Apr-2021 13:54:23 - Done

performing second normalization step...


------------------------------------------------------------------------
28-Apr-2021 13:54:24 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:54:24 - Running 'Segment'

SPM12: spm_preproc_run (v7670)                     13:54:24 - 28/04/2021
========================================================================
Segment /path/to/out/tmp/wmstructural3D.nii,1
Completed                               :          13:56:02 - 28/04/2021
28-Apr-2021 13:56:02 - Done    'Segment'
28-Apr-2021 13:56:02 - Done



------------------------------------------------------------------------
28-Apr-2021 13:56:04 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:56:04 - Running 'Coregister: Reslice'

SPM12: spm_reslice (v7141)                         13:56:04 - 28/04/2021
========================================================================
Completed                               :          13:56:05 - 28/04/2021
28-Apr-2021 13:56:05 - Done    'Coregister: Reslice'
28-Apr-2021 13:56:05 - Done

performing second normalization...


------------------------------------------------------------------------
28-Apr-2021 13:56:07 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:56:07 - Running 'Old Normalise: Estimate & Write'
Smoothing by 8 & 8mm..
Coarse Affine Registration..
Fine Affine Registration..
3D CT Norm...
 iteration  1:  FWHM =  22.32 Var = 10.9967
Saving Parameters..

SPM12: spm_write_sn (v4878)                        13:56:13 - 28/04/2021
========================================================================
Completed                               :          13:56:16 - 28/04/2021
28-Apr-2021 13:56:16 - Done    'Old Normalise: Estimate & Write'
28-Apr-2021 13:56:16 - Done

performing third normalization step...


------------------------------------------------------------------------
28-Apr-2021 13:56:16 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:56:16 - Running 'Segment'

SPM12: spm_preproc_run (v7670)                     13:56:16 - 28/04/2021
========================================================================
Segment /path/to/out/tmp/wwmstructural3D.nii,1
Completed                               :          13:58:56 - 28/04/2021
28-Apr-2021 13:58:56 - Done    'Segment'
28-Apr-2021 13:58:56 - Done



------------------------------------------------------------------------
28-Apr-2021 13:58:56 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:58:56 - Running 'Deformations'
wwmstructural3D	1,1,1
28-Apr-2021 13:58:57 - Done    'Deformations'
28-Apr-2021 13:58:57 - Done

combining deformations to derive total direct and inverse transformations...


------------------------------------------------------------------------
28-Apr-2021 13:58:58 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:58:58 - Running 'Deformations'
28-Apr-2021 13:59:41 - Done    'Deformations'
28-Apr-2021 13:59:41 - Done



------------------------------------------------------------------------
28-Apr-2021 13:59:41 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 13:59:41 - Running 'Deformations'
28-Apr-2021 14:00:08 - Done    'Deformations'
28-Apr-2021 14:00:08 - Done

cleaning up temporary files...


------------------------------------------------------------------------
28-Apr-2021 14:00:09 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 14:00:09 - Running 'Segment'

SPM12: spm_preproc_run (v7670)                     14:00:09 - 28/04/2021
========================================================================
Segment /path/to/out/anatomy_prepro_mni.nii,1
Completed                               :          14:02:26 - 28/04/2021
28-Apr-2021 14:02:26 - Done    'Segment'
28-Apr-2021 14:02:26 - Done



------------------------------------------------------------------------
28-Apr-2021 14:02:26 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 14:02:26 - Running 'Deformations'
c1anatomy_prepro_mni	1,1,1
c2anatomy_prepro_mni	1,1,1
c3anatomy_prepro_mni	1,1,1
c4anatomy_prepro_mni	1,1,1
c5anatomy_prepro_mni	1,1,1
c6anatomy_prepro_mni	1,1,1
c7anatomy_prepro_mni	1,1,1
c8anatomy_prepro_mni	1,1,1
c9anatomy_prepro_mni	1,1,1
c10anatomy_prepro_mni	1,1,1
c11anatomy_prepro_mni	1,1,1
c12anatomy_prepro_mni	1,1,1
28-Apr-2021 14:02:50 - Done    'Deformations'
28-Apr-2021 14:02:50 - Done



------------------------------------------------------------------------
28-Apr-2021 14:02:51 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 14:02:51 - Running 'Deformations'
tmp	1,1,1
28-Apr-2021 14:02:53 - Done    'Deformations'
28-Apr-2021 14:02:53 - Done



------------------------------------------------------------------------
28-Apr-2021 14:02:54 - Running job #1
------------------------------------------------------------------------
28-Apr-2021 14:02:54 - Running 'Deformations'
tmp	1,1,1
28-Apr-2021 14:02:56 - Done    'Deformations'
28-Apr-2021 14:02:56 - Done


SPM12: spm_reslice (v7141)                         14:02:56 - 28/04/2021
========================================================================
Completed                               :          14:03:04 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:04 - 28/04/2021
========================================================================
Completed                               :          14:03:11 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:12 - 28/04/2021
========================================================================
Completed                               :          14:03:19 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:19 - 28/04/2021
========================================================================
Completed                               :          14:03:27 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:27 - 28/04/2021
========================================================================
Completed                               :          14:03:35 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:35 - 28/04/2021
========================================================================
Completed                               :          14:03:42 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:43 - 28/04/2021
========================================================================
Completed                               :          14:03:50 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:50 - 28/04/2021
========================================================================
Completed                               :          14:03:58 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:03:58 - 28/04/2021
========================================================================
Completed                               :          14:04:06 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:04:06 - 28/04/2021
========================================================================
Completed                               :          14:04:13 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:04:14 - 28/04/2021
========================================================================
Completed                               :          14:04:21 - 28/04/2021

SPM12: spm_reslice (v7141)                         14:04:22 - 28/04/2021
========================================================================
Completed                               :          14:04:29 - 28/04/2021
::: MR-TIM :::   STEP 3/3 - Tissue segmentation...
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12
Adjusting...
Saving results...
::: MR-TIM processing DONE! :::
28-Apr-2021 14:06:17 - Done    'Run'
28-Apr-2021 14:06:17 - Done

Once done, I obtained the following files;

.
โ”œโ”€โ”€ anatomy.nii
โ”œโ”€โ”€ anatomy_prepro_mni.nii
โ”œโ”€โ”€ anatomy_prepro_mni_seg8.mat
โ”œโ”€โ”€ anatomy_prepro.nii
โ”œโ”€โ”€ anatomy_prepro_segment.nii
โ”œโ”€โ”€ anatomy_prepro_tpm.nii
โ”œโ”€โ”€ iy_anatomy_prepro.nii
โ”œโ”€โ”€ y_anatomy_prepro.nii
โ””โ”€โ”€ tissue_masks
 ย ย  โ”œโ”€โ”€ bGM.nii
 ย ย  โ”œโ”€โ”€ brainstem.nii    (Almost empty)
 ย ย  โ”œโ”€โ”€ bWM.nii          (Empty)
 ย ย  โ”œโ”€โ”€ cGM.nii          (Empty)
  ย  โ”œโ”€โ”€ compacta.nii
  ย  โ”œโ”€โ”€ CSF.nii
 ย ย  โ”œโ”€โ”€ cWM.nii
 ย ย  โ”œโ”€โ”€ eyes.nii
 ย ย  โ”œโ”€โ”€ fat.nii
    โ”œโ”€โ”€ muscle.nii
 ย   โ”œโ”€โ”€ skin.nii
   ย โ””โ”€โ”€ spongiosa.nii

Opening the anatomy_prepro_segment.nii file, I get:
image

As shown in the histogram, bWM, cWM and brainstem classes are empty. When I open these files, the are indeed empty. Only the brainstem has voxels set to 1 but only in one layer and in a very small region:
image

In addition, you can see that some voxels on the top of the head are classified as CSF but should not.

Do you, by any chance, have an idea on how to fix this (from my side or from yours)?

Thanks in advance ๐Ÿ™‚

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.