Skip to content

Instantly share code, notes, and snippets.

@caticoa3
caticoa3 / ilastik_run.sh
Last active June 15, 2018 19:11
Running ilastik at command line with two processors and targeted maximum of 2000MB of ram
LAZYFLOW_THREADS=2 LAZYFLOW_TOTAL_RAM_MB=2000 ~/Applications/ilastik-1.3.0-Linux/run_ilastik.sh --headless --project segmentation_0_corrected.ilp --raw_data IllumCorr/*.??.??/*/*CY3*IC.tiff --output_format tiff --output_filename_format {dataset_dir}/{nickname}_{result_type}.tiff --export_source="Simple Segmentation"
@caticoa3
caticoa3 / ignore_CP_save_erros.sh
Created June 29, 2018 18:49
Bash script to ignore save errors when processing multiple images from command line with Cell Profiler
#!/bin/bash
n=1 #Image Set number to start processing batch
final_image=826 #Last Image Set number in your batch
cellprofiler -p ML/Batch_data.h5 -c -r -f $n -l $final_image |& tee log.txt #Here the output from terminal is save to log.txt.
while [ $? -ne 1 ]; do
#Parse log.txt file, extracting the image set # at which the error occurs
no_save_error_image=$(sed -n '/^.*ValueError:/{n;p}' log.txt | sed -n -e 's/^.Image # //p' | sed -n -e 's/, module SaveImages.$//p')
n_=$(($no_save_error_image + 1))
#Restart CellProfiler at the next image set
@caticoa3
caticoa3 / ga_in_dash.py
Last active May 26, 2020 06:22
google_analytics_in_dash_apps
app.index_string = '''<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX', 'auto');
@caticoa3
caticoa3 / .block
Last active June 13, 2020 19:09 — forked from john-guerra/.block
GeoJson map of Colombia Municipios
license: mit
@caticoa3
caticoa3 / contour_crop.py
Created June 29, 2018 20:04
Crops objects out of images. A mask that segments each object and the original image need to be provided.
# coding: utf-8
import os
import numpy as np
import cv2
from pathlib2 import Path
#import re
'''Run on Python2.7'''
image_dir = '../IllumCorr/'