Skip to content

Instantly share code, notes, and snippets.

View habi's full-sized avatar

David Haberthür habi

View GitHub Profile
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
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)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@habi
habi / makefile
Last active November 17, 2022 14:21
My makefile, based on http://git.io/GIs6og
## Makefile based on http://git.io/GIs6og
## Define standard Markdown extension
MEXT = md
## All markdown files in the working directory
SRC = $(wildcard *.$(MEXT))
## Bibliography
BIB = /home/habi/P/Documents/library.bib
@habi
habi / Systematic Random Sampling.ipynb
Last active September 1, 2017 15:32
Systematic random sampling in a Python list
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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')