Skip to content

Instantly share code, notes, and snippets.

View valosekj's full-sized avatar

Jan Valosek valosekj

View GitHub Profile
@valosekj
valosekj / git_collaboration.md
Last active November 7, 2022 14:54
Simple workflow of collaboration in small team using git and GitHub

Simple workflow of collaboration in small team using git and GitHub

This gist describes example of simple workflow on repository whose changes are tracked by git and GitHub

1) Clone (download repository from GitHub to your computer)

# Go to directory where repository will be cloned (downloaded)
cd ~/Documents
# Clone repository from GitHub
@valosekj
valosekj / ssh_configuration.md
Last active September 27, 2022 06:45
Configuration of `ssh` connection #blog

Configuration of ssh connection

Unix and MacOS

Let's say we want to configure an ssh connection between machine alpha and beta.

  1. Go to your home folder at machine alpha:
$ cd ~
@valosekj
valosekj / change_itk_direction.py
Last active February 25, 2023 20:32
Fix ITK direction for nnU-Net
# Set ITK direction from image1 to image2
#
# Usage:
# python change_itk_orientation.py <image1> <image2>
# Example:
# python change_itk_orientation.py sub-001_T1w.nii.gz sub-001_T1w_seg.nii.gz
#
# Jan Valosek
#
import os
import glob
import hashlib
import argparse
def compute_checksum(file_path):
with open(file_path, 'rb') as f:
file_bytes = f.read()
return hashlib.md5(file_bytes).hexdigest()
@valosekj
valosekj / template_script_sct_run_batch.md
Created July 18, 2023 19:36
Template script for `sct_run_batch`

Template script for sct_run_batch

This gist contains a template script that can be run across multiple subjects using the sct_run_batch wrapper script.

The template bash script below can be run from you command line using the following command:

sct_run_batch -script example_script.sh -path-data <DATA> -path-output <DATA>_202X-XX-XX -jobs 16
@valosekj
valosekj / custom_FSLeyes_scene.png
Last active September 18, 2023 20:34
Set up a custom scene using the FSLeyes API via a custom Python script
custom_FSLeyes_scene.png
@valosekj
valosekj / load_python_colormap_to_fsleyes.md
Created October 23, 2023 23:24
Load a Python colormap to FSLeyes

Load a Python colormap to FSLeyes

Get RGB colors, one per line, for a given Python colormap. In the script below, we get RGB colors for the jet matplotlib colormap.

import matplotlib.pyplot as plt
import numpy as np

# Generate the jet colormap
cmap = plt.cm.get_cmap('jet')