Skip to content

Instantly share code, notes, and snippets.

def to_pillow(img):
# https://github.com/imageio/imageio/blob/master/imageio/plugins/pillowmulti.py#L371
# img = np.concatenate((img,255*np.ones(list(img.shape[:2])+[1],dtype='uint8')),axis=-1)
# img = Image.fromarray(img.astype('uint8'), 'RGBA')
img = Image.fromarray(img.astype('uint8'), 'RGB')
# a_channel = Image.new('L', img.size, 255) # 'L' 8-bit pixels, black and white
# img.putalpha(a_channel)
# p = img.getpalette()
# img = img.convert('P', dither=None,colors=1024)
# #img.putpalette

UCL Medical Imaging CDT partnerships







Notes for MacOSX

  • Anaconda installer:

      wget http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-2.1.0-MacOSX-x86_64.sh
    
  • When installing opencv:

conda install opencv

cmake -D OpenMP_CXX_FLAGS:STRING=-fopenmp -D OpenMP_C_FLAGS:STRING=-fopenmp -D CMAKE_CXX_COMPILER:FILEPATH=/usr/local/bin/clang-omp++ -D CMAKE_C_COMPILER:FILEPATH=/usr/local/bin/clang-omp ..

brew install graphviz
pip install theano pydot-ng keras h5py

Bleeding edge:

pip install git+https://github.com/fchollet/keras.git --upgrade

OpenMP support

git clone https://github.com/BioMedIA/MIRTK.git
cd MIRTK/
git submodule update --init
mkdir build
cd build/
cmake ..
ccmake ..

make -j 8