Skip to content

Commit

Permalink
Merge pull request #6 from hansenms/final_revisions
Browse files Browse the repository at this point in the history
Final revisions
  • Loading branch information
hansenms committed Aug 13, 2015
2 parents 3fd9e68 + 6afdc90 commit ae261d3
Show file tree
Hide file tree
Showing 11 changed files with 84,565 additions and 84,480 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ old
*.aux
*.fff
*.lof
*.h5
*.h5
code/ismrmrd_data/
*.zip
*_hash.tex
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

CURRENT_VERSION = ismrmrd_manuscript_mrm
THE_GOAL = ismrmrd_paper
TARGETS = $(THE_GOAL)

SHA1 = $(shell git rev-parse HEAD)


$(THE_GOAL).pdf: $(CURRENT_VERSION)_hash.tex
latex $(CURRENT_VERSION)_hash.tex
bibtex $(CURRENT_VERSION)_hash
latex $(CURRENT_VERSION)_hash.tex
latex $(CURRENT_VERSION)_hash.tex
dvipdf $(CURRENT_VERSION)_hash.dvi $(THE_GOAL).pdf

$(CURRENT_VERSION)_hash.tex: $(CURRENT_VERSION).tex
sed -e s/MANUSCRIPT_SHA1/$(SHA1)/ $(CURRENT_VERSION).tex > $(CURRENT_VERSION)_hash.tex

# so that when latex is re-run, it will get all references right

update:
touch $(CURRENT_VERSION)_hash.tex

really:
rm -f *.ps $(THE_GOAL).pdf $(CURRENT_VERSION).pdf

clean:
rm -f *~ *.bbl *.blg *.pdf *.log *.aux *.bak *.dvi *.sav *.out *.nav *.snm *.toc *.fff *.lof $(CURRENT_VERSION)_hash.tex

23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ISMRMRD Manuscript
-------------------

This repository contains the manuscript and associated example code for the ISMRM Raw Data format.

If you have latex installed, you can generate a PDF of the manuscript with

$ make

To run the example reconstructions:

$ cd code
$ ./doit.sh

This will download the test data and run reconstructions (C++, Matlab, and Python).

For all reconstructions to work, you must have:

1. Compiled and installed ISMRMRD (https://github.com/ismrmrd/ismrmrd)
2. Have added the path (``<ISMRMRD_SOURCE>/matlab``) to the Matlab API to your Matlab installation.
3. Have installed the Python ISMRMRD API (https://github.com/ismrmrd/ismrmrd-python)

On Windows computers or for individual steps (download and reconstructions), please see the ``code/doit.sh`` script for details.
6 changes: 6 additions & 0 deletions code/do_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

rm -f *.h5
rm -f *.zip
rm -rf ismrmrd_data

4 changes: 3 additions & 1 deletion code/do_get_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
ismrmrd_generate_cartesian_shepp_logan -m 512 -o synth.h5

# Copy the scanner data here
cp ../data/*.h5 .
wget https://github.com/ismrmrd/ismrmrd/releases/download/v1.2.3-data/ismrmrd_data.zip
unzip ismrmrd_data.zip
find ismrmrd_data -name "*.h5" -exec cp {} . \; -print



Expand Down
39 changes: 24 additions & 15 deletions code/do_makefigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@
import ismrmrd
import h5py

def window_image(im,win_low=1,win_high=95):
imhist,bins = np.histogram(im.flatten(),100,normed=True)
im2 = im;
im2[im2 < bins[win_low]] = bins[win_low]
im2[im2 > bins[win_high]] = bins[win_high]
im2 = 255.0*(im2 - bins[win_low])/bins[win_high]
return im2


fid = h5py.File('bruker.h5','r')
bruk_cpp = np.squeeze(np.array(fid.get('/dataset/cpp/data')))
bruk_mat = np.squeeze(np.array(fid.get('/dataset/matlab')))
bruk_py = np.squeeze(np.array(fid.get('/dataset/python')))
fid.close()
bruk_cpp *= 255/(0.9*np.max(bruk_cpp))
bruk_mat *= 255/(0.9*np.max(bruk_mat))
bruk_py *= 255/(0.9*np.max(bruk_py))
bruk_cpp = window_image(bruk_cpp)
bruk_mat = window_image(bruk_mat)
bruk_py = window_image(bruk_py)

fid = h5py.File('ge.h5','r')
ge_cpp = np.squeeze(np.array(fid.get('/dataset/cpp/data')))
Expand All @@ -19,38 +28,38 @@
fid.close()
# GE-data has chop so artifact at the edge of the image
ge_cpp[0:1,:]=ge_cpp[2,:]
ge_cpp *= 255/(0.9*np.max(ge_cpp))
ge_cpp = window_image(ge_cpp,win_low=20,win_high=50)
ge_mat[0:1,:]=ge_mat[2,:]
ge_mat *= 255/(0.9*np.max(ge_mat))
ge_mat = window_image(ge_mat,win_low=20,win_high=50)
ge_py[0:1,:]=ge_py[2,:]
ge_py *= 255/(0.9*np.max(ge_py))
ge_py = window_image(ge_py,win_low=20,win_high=50)

fid = h5py.File('philips.h5','r')
phil_cpp = np.squeeze(np.array(fid.get('/dataset/cpp/data')))
phil_mat = np.squeeze(np.array(fid.get('/dataset/matlab')))
phil_py = np.squeeze(np.array(fid.get('/dataset/python')))
fid.close()
phil_cpp *= 255/(0.9*np.max(phil_cpp))
phil_mat *= 255/(0.9*np.max(phil_mat))
phil_py *= 255/(0.9*np.max(phil_py))
phil_cpp = window_image(phil_cpp,win_low=12,win_high=75)
phil_mat = window_image(phil_mat,win_low=12,win_high=75)
phil_py = window_image(phil_py,win_low=12,win_high=75)

fid = h5py.File('siemens.h5','r')
siem_cpp = np.squeeze(np.array(fid.get('/dataset/cpp/data')))
siem_mat = np.squeeze(np.array(fid.get('/dataset/matlab')))
siem_py = np.squeeze(np.array(fid.get('/dataset/python')))
fid.close()
siem_cpp *= 255/(0.9*np.max(siem_cpp))
siem_mat *= 255/(0.9*np.max(siem_mat))
siem_py *= 255/(0.9*np.max(siem_py))
siem_cpp = window_image(siem_cpp,win_low=12,win_high=65)
siem_mat = window_image(siem_mat,win_low=12,win_high=65)
siem_py = window_image(siem_py,win_low=12,win_high=65)

fid = h5py.File('synth.h5','r')
syn_cpp = np.squeeze(np.array(fid.get('/dataset/cpp/data')))
syn_mat = np.squeeze(np.array(fid.get('/dataset/matlab')))
syn_py = np.squeeze(np.array(fid.get('/dataset/python')))
fid.close()
syn_cpp = 255/(0.9*np.max(syn_cpp)) * syn_cpp[::-1,:]
syn_mat = 255/(0.9*np.max(syn_mat)) * syn_mat[::-1,:]
syn_py = 255/(0.9*np.max(syn_py)) * syn_py[::-1,:]
syn_cpp = window_image(syn_cpp)
syn_mat = window_image(syn_mat)
syn_py = window_image(syn_py)

w, h = 5.,3.
dw, dh = 0.75, 0.4
Expand Down
5 changes: 5 additions & 0 deletions code/do_recon_matlab.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
%
% For this code to work, you must add <ISMRMRD_SOURCE>/matlab to your path
% You also need to download the test data
% https://github.com/ismrmrd/ismrmrd/releases/download/v1.2.3-data/ismrmrd_data.zip
%
function do_recon_matlab()

fnames = {'synth.h5', 'bruker.h5', 'ge.h5', 'philips.h5', 'siemens.h5'};
Expand Down
7 changes: 7 additions & 0 deletions code/do_recon_python.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#
# In order to run this code, you must:
# 1. Install the ismrmrd python api from:
# https://github.com/ismrmrd/ismrmrd-python
# 2. Download the test data from https://github.com/ismrmrd/ismrmrd/releases/download/v1.2.3-data/ismrmrd_data.zip
#

import numpy as np
from numpy.fft import fftshift, ifftshift, fftn, ifftn
import ismrmrd
Expand Down
2 changes: 1 addition & 1 deletion code/doit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ python do_makefigs.py
mv *.eps ../figures

# Clean up
rm -f *.h5
./do_clean.sh
Loading

0 comments on commit ae261d3

Please sign in to comment.