Skip to content

Instantly share code, notes, and snippets.

View gireeshkbogu's full-sized avatar

Gireesh Bogu gireeshkbogu

View GitHub Profile
steps
2020-02-01 00:00:00 0
2020-02-01 00:01:00 0
2020-02-01 00:02:00 0
2020-02-01 00:03:00 0
2020-02-01 00:04:00 0
2020-02-01 00:05:00 0
2020-02-01 00:06:00 0
2020-02-01 00:07:00 0
2020-02-01 00:08:00 0
Subject datetime Type Count
User1 4/16/20 15:00 A1 1
User2 3/28/20 13:00 A1 1
User3 4/29/20 15:00 A1 1
User4 5/2/20 9:00 A1 1
User5 2/19/20 18:00 A1 1
User6 4/20/20 16:00 A1 1
User7 5/4/20 20:00 A1 1
User8 4/4/20 16:00 A1 1
User9 4/5/20 8:00 A1 1
@gireeshkbogu
gireeshkbogu / nii_to_png.sh
Last active April 11, 2020 21:40
Converts .nii format to .jpg or .png format
# source: https://pypi.org/project/med2image/
# https://stackoverflow.com/questions/29640641/how-to-convert-nii-format-file-into-2d-image
# requirements
#pip3 install pydicom
#pip3 install med2image
#pip3 install pudb
#pip3 install pfmisc
#$1 = input.nii
@gireeshkbogu
gireeshkbogu / add_prefix_to_filenames.sh
Created April 8, 2020 19:32
Adds a prefix to multiple file names
for filename in *.jpg; do mv "$filename" "prefix_$filename"; done;
@gireeshkbogu
gireeshkbogu / mask_class_names_modifier.py
Created April 5, 2020 13:41
Changes the unordered class names of multiple image masks in a give folder
import sys
import os
from PIL import Image
import shutil
import numpy as np
mask_dir = "/Users/gireeshbogu/Downloads/MSNYD_8_22_17/MSNYD_8_22_17__AB_AXT1_fl2d_inopp_mbh_15/masks_machine/"
new_mask_dir = "/Users/gireeshbogu/Downloads/MSNYD_8_22_17__AB_AXT1_fl2d_inopp_mbh_15_masks/"
if not os.path.exists(new_mask_dir):
@gireeshkbogu
gireeshkbogu / mask_filter.py
Last active April 8, 2020 19:03
Filter images with at least one mask (sum of all pixels > 0) and copy them to a new folder
# identify images with at least one mask (sum of all pixels > 0) and copy them to a new folder
# usage: script.py mask_dir new_mask_dir
import sys
import os
from PIL import Image
import shutil
import pandas as pd
import numpy as np
@gireeshkbogu
gireeshkbogu / jpg_to_png.py
Last active March 5, 2020 20:27
Convert JPEG format to PNG
from glob import glob
import cv2
jpgs = glob('./*.jpg')
for image in jpgs:
img = cv2.imread(image)
cv2.imwrite(image[:-3] + 'png', img)
@gireeshkbogu
gireeshkbogu / simulate_data.sh
Last active April 5, 2020 14:01
Simulate Omics style data for Machine Learning programs
# Simulate Omics style data for ML
import uuid
import itertools
features = 700
subjects = 40
columns_list = []
@gireeshkbogu
gireeshkbogu / segmentation_kits2019_using_fastai_test_version.ipynb
Last active October 9, 2019 22:01
segmentation_kits2019_using_fastai_test_version
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.