Skip to content

Instantly share code, notes, and snippets.

View rmukh's full-sized avatar
👋
Focusing

Rinat M rmukh

👋
Focusing
View GitHub Profile
@rmukh
rmukh / read_freesurefer_lut.py
Last active January 19, 2024 13:15
Script to read FreeSurfer Color LUT table in Python 3
import numpy as np
import re
"""
The link to the table: https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/AnatomicalROI/FreeSurferColorLUT
It is also available locally if FreeSurfer is installed: $FREESURFER_HOME/FreeSurferColorLUT.txt
Read and store FreeSufer LUT color table
The result is two variables:
@rmukh
rmukh / convhulln.cpp
Last active February 3, 2020 22:08
C/C++ function that generates a 3D convex hull using Delaunay triangulation. Eigen matrix is an input and an output. Requires VTK and Eigen libraries.
template<typename T>
T UtilMath::convhulln(T& u, double tol = 0.001) {
/*
Convex hull (might be a conflict between VTK 7 and 8 versions)
*/
// Convert from Eigen to vtkPoints (probably make as an function)
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
for (unsigned i = 0; i < u.rows(); ++i)
points->InsertNextPoint(u(i, 0), u(i, 1), u(i, 2));
@rmukh
rmukh / links.md
Last active November 16, 2023 17:31
Couple of useful 3D convex hull links
@rmukh
rmukh / prntscScraper.py
Last active January 3, 2019 20:43
Simple LightShot (prnt.sc) random scraper, crawler. Usage: python prntscScraper.py n_of_threads. Python 3. Made for research purposes only
from os import remove, path, makedirs
from random import choices, randint
from sys import argv, exit
from urllib.request import urlretrieve
from string import digits, ascii_uppercase, ascii_lowercase
from threading import Thread
#global variables
incrt_sizes = [0, 503, 4939, 4940, 4941, 12003, 5556]
temp = 1