GithubHelp home page GithubHelp logo

statpal / symr Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 260.75 MB

C++, R and Python package for the Synthetic MR imaging program symr. For the R and python programs, see the R and python branches respectively.

License: GNU General Public License v3.0

C++ 95.04% Dockerfile 0.19% Starlark 0.39% Python 3.28% MATLAB 0.77% CMake 0.33%
r synthetic-mri rcpp cpp mri matrix-free em-algorithm python

symr's Introduction

Synthetic MRI

What is symr?

symr is C++ software for Synthetic Magnetic Resonance (MR) technique which predicts images at new design parameter from few observed MR scans. The speciality of the method behind the symr is that it carefully uses both the physical and statistical properties of the underlying MR ssignal and noise. This is a theoretically sound and computationally practical matrix-free approach using multi-layered Gausssain Markov Random Field, which can predict images from as small as three MR scans, which can be used in individualized patient- and anatomy-specific contexts. We have also developed an accurate estimation of standard errors of the regional means in in the predicted images.

Installation and Usage:

Dependencies:

Make sure your system have the following softwares installed

We have used an optimizer in C++, which also uses Eigen, and recent versions can be found here

Download:

As this library is header only, you have to first clone/download the repository, go to the directory and then compile and run the corresponding files. If you have git in your system, go to a working folder and run:

git clone --depth=1 https://github.com/StatPal/symr.git
cd symr

Without using git, you can go to the link, download it and unzip it and then go to the symr directory/folder.

Usage and Instructions:

  • The data files (and the mask files) should be in Nifti format, unzipped. If gziped, unzip the files:

     cd ./data
     gunzip new_phantom.nii.gz
     cd ..
  • The file to be executed (for 2D) ECM: ./examples/2D/example_AECM.cpp

    First go to examples/2D

     cd ./examples/2D/

    Then compile:

     g++ example_AECM.cpp -o example_AECM -I /usr/include/eigen3 -O3 -lgsl -lgslcblas -lm -fopenmp

    Then run:

     ./example_AECM ../../data/new_phantom.nii Dummy_sd.txt 0

    where ../data/new_phantom.nii is the 2D data and Dummy_sd.txt is the file for σj's (rice noise parameter) for each image generated using sigma.cpp. (See this subsection for details).

  • For OSL, everything would be similar, just the cpp file would be changed to example_OSL.cpp

  • For Variance estimate of a contrast vector(c, of size n), we have an example file with class (generated with R package mritc) First go to examples/2D

     cd ./examples/2D/

    Then compile:

     g++ example_VAR_part.cpp -o example_VAR_part -I /usr/include/eigen3 -O3 -lgsl -lgslcblas -lm -fopenmp

    Then run:

     ./example_VAR_part ../data/new_phantom.nii ../data/new_phantom_class.nii Dummy_sd.txt 0

    where ../data/new_phantom_class.nii is the file denoting class file.

  • For 3D, you have to go to ./example/3D instead of ./example/2D and run everything similarly with 3D data.

  • The location of 2D data: ./data/new_phantom.nii (see `**' for any 2D file) and the 3D data ./data/ZHRTS1.nii

  • The 3rd-party optimizer location: ./CppNumericalSolvers

The current tree structure is as follows:

.
|-- data
|   `-- new_phantom.nii.gz
|-- docs
|   `-- Doxyfile
|-- examples
|   |-- 2D
|   |   |-- example_AECM.cpp
|   |   |-- example_OSL.cpp
|   |   |-- example_VAR.cpp
|   |   |-- example_VAR_part.cpp
|   |   |-- result
|   |   `-- sigma.cpp
|   `-- 3D
|       |-- example_AECM.cpp
|       |-- example_OSL.cpp
|       |-- example_VAR.cpp
|       |-- example_VAR_part.cpp
|       |-- result
|       `-- sigma.cpp
|-- include
|   |-- 2D
|   |   |-- functions_AECM.hpp
|   |   |-- functions_gen.hpp
|   |   |-- functions_LS_and_init_value.hpp
|   |   |-- functions_OSL.hpp
|   |   |-- functions_VAR.hpp
|   |   `-- read_files.hpp
|   `-- 3D
|       |-- functions_AECM.hpp
|       |-- functions_gen.hpp
|       |-- functions_LS_and_init_value.hpp
|       |-- functions_OSL.hpp
|       |-- functions_VAR.hpp
|       `-- read_files.hpp
`-- README.md

Generation of sigmas

To create the file corresponding to the σj(rice noise parameter) for each image if they are not present,

First go to examples/2D

cd ./examples/2D/

Then compile:

g++ sigma.cpp -o sigma -I /usr/include/eigen3 -O3 -lgsl -lgslcblas -lm

Then run:

./sigma ../../data/new_phantom.nii Dummy_sd.txt 0

where Dummy_sd.txt is the output file containing estimated σj's, i.e., the rice noise parameters.

(`**' new_phantom.nii is actually transformed from phantom.nii(2D)

For any 2D data, the dimension format should be c(4, n_x, n_y, 1, m, 1, 1, 1)

You can use R('oro.nifti') to read phantom.nii and then use dim_(phantom) <- c(4, 256, 256, 1, 18, 1, 1, 1) # or equivalent to change the dimension - as the dim are written in X, Y, Z, T/M - in this order. It wold be directly incorporated through Read_files_2.cpp later. )

symr's People

Contributors

maitra avatar statpal avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.