Skip to content

Instantly share code, notes, and snippets.

View habi's full-sized avatar

David Haberthür habi

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Reads DICOM-Files exported with
% p:\doc\MeVisLab-Networks\2011\ExtractAcinusAndExport.mlab and save them
% as JPG image sequences to further peruse with the STEPanizer.com
% First version: 20.06.2011, reading and displaying the DICOM-file
% 28.07.2011: Now reads ALL the DICOM-Files in the directory selected on
% Line 16 and converts them in one batch.
clc
clear all
@habi
habi / Labelling.ipynb
Created November 3, 2017 14:22
Counting how many things we have in a (binarized) image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habi
habi / Extract necrotic core.ipynb
Last active September 6, 2017 13:58
Detect the necrotic center of a tumor (where we don't have any vessels)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
## Makefile based on http://git.io/GIs6og
## Now at https://github.com/kjhealy/pandoc-templates/blob/master/examples/starting_from_markdown/Makefile
## Define standard Markdown extension
MEXT = md
## All markdown files in the working directory
SRC = $(wildcard *.$(MEXT))
## Bibliography
@habi
habi / Systematic Random Sampling.ipynb
Last active September 1, 2017 15:32
Systematic random sampling in a Python list
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habi
habi / collage.sh
Last active June 7, 2022 12:33
Make a collage of all team members
# https://gist.github.com/habi/843646709a22004fb5654ab6d9a134d6#file-collage-sh
cd ~/tmp
# Get all images from our team website
wget https://www.anatomie.unibe.ch/pages/forsch_myct_team.php --page-requisites --accept .jpg --no-clobber --quiet
# Scale images to approximately the same size as my head (264x350)
mogrify -resize 264x350 www.anatomie.unibe.ch/users/hlushchuk/kopf.jpg
mogrify -resize 264x350 www.anatomie.unibe.ch/users/khoma/kopf.jpg
# See how big the files are (if needed)
#identify www.anatomie.unibe.ch/users/*/kopf.jpg
# Generate montage
@habi
habi / Interaction.ipynb
Created March 22, 2017 15:19
Implementing a simple slice browser
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habi
habi / shiftimage.py
Created July 27, 2016 12:39
Shift an image to its centroid
from scipy import ndimage
import numpy
def shiftimagetocentroid(image):
imagecenter = [l/2 for l in numpy.shape(image)]
centroid = ndimage.measurements.center_of_mass(image)
print(centroid)
shift = numpy.subtract(imagecenter, centroid)
print(shift)
image = scipy.ndimage.interpolation.shift(image, shift, mode='wrap')