Skip to main content

Image utility functions for personal use

Project description


A simple toolbox for processing and visualizing medical images.




A tool to visualize 3D volume and segmentations in the same time.

# Create fake data
import numpy as np
import matplotlib.pyplot as plt
vol = np.zeros((50, 128, 128))
vol[20:30, 40:88, 40:88] = 1
vol += 0.1*np.random.rand(*vol.shape)
# plt.imshow(vol[25,:,:], cmap='gray')

seg1 = np.zeros((50, 128, 128))
seg1[20:30, 40:88, 40:88] = 1

seg2 = np.zeros((50, 128, 128))
seg2[20:29, 45:95, 45:95] = 1
seg2[29, 40:88, 40:88] = 1

fig, axs = plt.subplots(1,3)
axs[0].imshow(np.squeeze(vol[25,:,:]), cmap='gray')
axs[1].imshow(np.squeeze(seg1[25,:,:]), cmap='gray')
axs[2].imshow(np.squeeze(seg2[25,:,:]), cmap='gray')

# Visualize using VolSlicer
from jximgtools.metric import dicePerSlice, dice
from jximgtools.visualization.volSlicer import VolSlicer

dicee = dice(seg1, seg2)
dices = dicePerSlice(seg1, seg2)
volInfo = {'Name': 'Test Volume', 'DicePerSlice': dices}
slicesInfo = [{'Dice': dices[sliceIdx]} for sliceIdx in range(50)]
VolSlicer(vol, volInfo = volInfo, segs = [seg1, seg2], slicesInfo = slicesInfo)


pip install jximgtools

Project details

Download files

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

Files for jrImgTools, version 0.3.3
Filename, size File type Python version Upload date Hashes
Filename, size jrImgTools-0.3.3-py3-none-any.whl (11.7 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page