Skip to content

Instantly share code, notes, and snippets.

View lesolorzanov's full-sized avatar
:shipit:

Leslie Evelyn Solorzano lesolorzanov

:shipit:
  • Uppsala, Sweden
View GitHub Profile
@lesolorzanov
lesolorzanov / itk.cxx
Last active September 1, 2015 11:36
My ITK tips
/*
* Create a float image the size of a short image
* This is an example of how to create an image of
* a different type but same size as a given image
*/
FloatImageType::Pointer ppRecruitImage = FloatImageType::New();
//define origin and size the same as the input
//get the biggest region (which usually is the whole image)
@lesolorzanov
lesolorzanov / DrawTowers.py
Last active October 15, 2015 01:24
Draw Towers around a circle
def DrawTower(x,y,z,a):
bpy.ops.mesh.primitive_cube_add(location=(x,y,z+1), rotation = (0,0,a))
bpy.ops.mesh.primitive_cylinder_add(location=(x,y,z+3), rotation = (0,0,a))
bpy.ops.mesh.primitive_cone_add(location=(x,y,z+5), rotation = (0,0,a))
def DrawTowers(n):
for i in range (0,n):
DrawTower(cos((2*pi*i)/n)*4,sin((2*pi*i)/n)*4,0,2*pi/n*i)
def DrawTowersCircle(n,r,cx,cy):
@lesolorzanov
lesolorzanov / commands.sh
Last active November 11, 2016 09:08
General bash commands I use
#Copy directory structure
cd /path/to/directories &&
find . -type d -exec mkdir -p -- /path/to/backup/{} \;
#copy files of certain extension
#http://superuser.com/questions/299938/how-can-i-recursively-copy-files-by-file-extension-preserving-directory-structu
cd /source/path
find -type f -name \*.txt -exec install -D {} /dest/path/{} \;
@lesolorzanov
lesolorzanov / voxelsimagetiff.py
Created January 9, 2017 11:04
Cubes from voxels
from PIL import Image
import numpy
im=Image.open('C:/Users/Administrator/Documents/Leslie/Uppsala/registered161101/crops/b1-2-0001-1757-1887-White Top Hat.tif')
def makeMaterial(name, diffuse, specular, alpha):
mat = bpy.data.materials.new(name)
mat.diffuse_color = diffuse
mat.diffuse_shader = 'LAMBERT'
mat.diffuse_intensity = 1.0
@lesolorzanov
lesolorzanov / screens.m
Created January 9, 2017 11:05
Enhances spots and creates gimplike screen version
clear all;
base=5;
if(base==1)
b3=imread('MAX_base_1_ch3.tif');
b4=imread('MAX_base_1_ch4.tif');
b5=imread('MAX_base_1_ch5.tif');
b6=imread('MAX_base_1_ch6.tif');
finalname='b1-color.tif';
@lesolorzanov
lesolorzanov / isosurfacespots.m
Created January 9, 2017 11:07
Iso surface from image
close all
clear all
fname ='C:\Users\Administrator\Documents\Leslie\Uppsala\registered161101\crops\b1-2-0001-1757-1887-White Top Hat.tif';
info = imfinfo(fname);
num_images = numel(info);
w =info.Width;
h= info.Height;
<html>
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.8.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="/home/leslie/Downloads/iWildCam_2019_iNat_Idaho.json"></script>
<script src="/home/leslie/Downloads/iWildCam_2019_CCT_Bboxes.json"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lesolorzanov
lesolorzanov / alpha.py
Last active July 14, 2019 22:33
Draw alpha levels blender
location="/home/leslie/Documents/alphaamd/"
imgs=["cells2little.png"]
def drawboxesat(pdx, iw, ih, q):
step=1/q
for x in range(iw):
for y in range(ih):
intensity=pdx[(x,y)][0]
if intensity==0:
@lesolorzanov
lesolorzanov / QuPathImportAnnotations.groovy
Last active December 9, 2020 10:25
Importig Annotation path objects after classifying outside of QuPath
// Title: Importig Annotation path objects after classifying outside of QuPath
// Author: Leslie Solorzano
// Date: 9 dec 2020
import qupath.lib.objects.PathObjects
import qupath.lib.roi.ROIs
import qupath.lib.regions.ImagePlane
import qupath.lib.io.GsonTools
import qupath.lib.geom.Point2
import qupath.lib.objects.classes.PathClass