Code Monkey home page Code Monkey logo

mrivis's Introduction

mrivis

Tools for comparison of registration and spatial similarity of 3d MRI scans (T1, T2, PET etc) using checkerboard plots.

https://img.shields.io/pypi/v/mrivis.svg

Installation

pip install -U mrivis

Usage:

Note: this package is in ACTIVE development. Expect minor bugs, along frequent fixes/changes.

from mrivis import checkerboard, voxelwise_diff, color_mix

path1 = '/Users/Reddy/Desktop/image.nii'
path2 = '/Users/Reddy/Desktop/another.nii'

checkerboard(path1, path2, patch_size=5) # square patches

checkerboard(path1, path2, rescale_method=(0, 256) )

checkerboard(path1, path2, patch_size=10,
             num_rows=1, num_cols=3) # 1 row per dimension, with 3 columns

checkerboard(path1, path2, patch_size=[10, 20], # rectangular patches
             num_rows=2, # 2 rows per dimension (6 rows in total)
             num_cols=5) # 5 panels per row

voxelwise_diff(path1, path2)
voxelwise_diff(path1, path2, abs_value=False)

color_mix(path1, path2, alpha_channels=(1, 1))
color_mix(path1, path2, alpha_channels=(0.7, 1))

Various options available

Download this image to get a better look at the differences:

flyer

Comparing two BOLD images

flyer_haxby_mean_BOLD_subj_1_2

Sample outputs for checkerboard plots

When the two scans are mismatched:

vis_all3

When the mismatch is low (here a smoothed image is comapred to its original), you can see the differences in intensity (due to smoothing), but you can also see that they are both spatially aligned accurately:

flyer2_low_mismatch

With really low patch-sizes (e.g. 1, which is voxel-wise alternation), you can see the alignment even better:

vis_voxelwise_axial

When there is mismatch, you can clearly see it (patch size 15 voxels square):

vis_all3_mismatch_ps15

Let's make the patches a bit bigger (patch size 25 voxels square):

vis_all3_mismatch_ps25_axial vis_all3_mismatch_ps25_sagittal

Let's make the patches a even bigger (50 voxels square):

vis_all3_mismatch_ps50

Let's use a rectangular patch (10 voxels high and 30 voxels wide):

vis_all3_mismatch__rect_ps10_30_sagittal vis_all3_mismatch__rect_ps10_30_axial

If they were identical (no mismatch at all), you won't see any edges or borders:

identical

Full layout with 6x6 pangels can be seen in this folder.

More example outputs

Many more example outputs, for different combinations of parameters, can be seen in this example outputs folder in docs.

mrivis's People

Contributors

raamana avatar

Watchers

James Cloos 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.