Skip to main content

Multimodal models of 20 normal brains

Project description

The relevant file is README.ipynb, accessible via any of the following:

BrainWeb: Multimodal models of 20 normal brains

Download and Preprocessing for PET-MR Simulations

This notebook will not re-download/re-process files if they already exist.

  • Output data

  • ~/.brainweb/subject_*.npz: dtype(shape): float32(127, 344, 344)

  • Raw data source

  • ~/.brainweb/subject_*.bin.gz: dtype(shape): uint16(362, 434, 362)

  • Prerequisites

  • Python: requirements.txt (e.g. pip install -r ../../requirements.txt)


from __future__ import print_function, division
%matplotlib notebook
import brainweb
from brainweb import volshow
import numpy as np
from os import path
from tqdm.auto import tqdm
import logging
logging.basicConfig(level=logging.INFO)

Raw Data

# download
files = brainweb.get_files()

# read last file
data = brainweb.load_file(files[-1])

# show last subject
print(files[-1])
volshow(data, cmaps=['gist_ncar']);
~/.brainweb/subject_54.bin.gz
raw.png

Transform

Convert raw image data:

  • Siemens Biograph mMR resolution (~2mm) & dimensions (127, 344, 344)

  • PET/T1/T2/uMap intensities

  • randomised structure for PET/T1/T2

  • t (1 + g [2 G_sigma(r) - 1]), where

    • r = rand(127, 344, 344) in [0, 1),

    • Gaussian smoothing sigma = 1,

    • g = 1 for PET; 0.75 for MR, and

    • t = the PET or MR piecewise constant phantom

brainweb.seed(1337)

for f in tqdm(files, desc="mMR ground truths", unit="subject"):
    vol = brainweb.get_mmr_fromfile(
        f,
        petNoise=1, t1Noise=0.75, t2Noise=0.75,
        petSigma=1, t1Sigma=1, t2Sigma=1)
# show last subject
print(f)
volshow([vol['PET' ][:, 100:-100, 100:-100],
         vol['uMap'][:, 100:-100, 100:-100],
         vol['T1'  ][:, 100:-100, 100:-100],
         vol['T2'  ][:, 100:-100, 100:-100]],
        cmaps=['hot', 'bone', 'Greys_r', 'Greys_r'],
        titles=["PET", "uMap", "T1", "T2"]);
~/.brainweb/subject_54.bin.gz
mMR.png
# add some lesions
brainweb.seed(1337)
im3d = brainweb.add_lesions(vol['PET'])
volshow(im3d[:, 100:-100, 100:-100], cmaps=['hot']);
lesions.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brainweb-0.3.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brainweb-0.3.0-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file brainweb-0.3.0.tar.gz.

File metadata

  • Download URL: brainweb-0.3.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.32.2 CPython/2.7.15

File hashes

Hashes for brainweb-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d07b93dab694c087961fbabcccc6d2d0825880b538c9979d56bc25bb3856a4df
MD5 bb5189e79a13cf520e1d33b9def23731
BLAKE2b-256 2da5927c4a25ba4b5d1e59b235dc08cd5ca15858f602e119a4f778e36813951a

See more details on using hashes here.

File details

Details for the file brainweb-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: brainweb-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.32.2 CPython/2.7.15

File hashes

Hashes for brainweb-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bedcea937a82eafba6e79c6776a0236bf349220a73e849264ec1c8e6692084a3
MD5 5f358c596510c3331f9300482c2156ec
BLAKE2b-256 768ff986867ec40067dc2aea5d2521537ead25269280550fe096949e7a3ea668

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page