sudo apt-get install \
cmake cmake-data libcairo2-dev libxcb1-dev libxcb-ewmh-dev \
libxcb-icccm4-dev libxcb-image0-dev libxcb-randr0-dev \
libxcb-util0-dev libxcb-xkb-dev pkg-config python-xcbgen \
xcb-proto libxcb-xrm-dev i3-wm libasound2-dev libmpdclient-dev \
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import multiprocessing | |
| # split a list into evenly sized chunks | |
| def chunks(l, n): | |
| return [l[i:i+n] for i in range(0, len(l), n)] | |
| def do_job(job_id, data_slice): | |
| for item in data_slice: | |
| print "job", job_id, item |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from mpl_toolkits.mplot3d import Axes3D | |
| %matplotlib inline | |
| import seaborn as sns | |
| # set normal vector, and point on plane | |
| point = np.array([1, 2, 3]) | |
| normal = np.array([1, 1, 2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| g_LastCtrlKeyDownTime := 0 | |
| g_AbortSendEsc := false | |
| g_ControlRepeatDetected := false | |
| *CapsLock:: | |
| if (g_ControlRepeatDetected) | |
| { | |
| return | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def resample_img(itk_image, out_spacing=[2.0, 2.0, 2.0], is_label=False): | |
| # Resample images to 2mm spacing with SimpleITK | |
| original_spacing = itk_image.GetSpacing() | |
| original_size = itk_image.GetSize() | |
| out_size = [ | |
| int(np.round(original_size[0] * (original_spacing[0] / out_spacing[0]))), | |
| int(np.round(original_size[1] * (original_spacing[1] / out_spacing[1]))), | |
| int(np.round(original_size[2] * (original_spacing[2] / out_spacing[2])))] |