Skip to content

Instantly share code, notes, and snippets.

View mkitti's full-sized avatar

Mark Kittisopikul mkitti

View GitHub Profile
@mkitti
mkitti / rational_from_string.jl
Created April 13, 2021 17:01
Convert a decimal representation to a Rational in Julia
# Via Fredrik Ekre
# https://julialang.zulipchat.com/#narrow/stream/274208-helpdesk-.28published.29/topic/String.20macro.20for.20rationals.3F
function rational_from_string(s)
x, y = split(s, '.')
a = parse(Int, x)
b = parse(Int, y)
return a + b // 10^length(y)
end
macro rational_str(s)
julia> a = 10
10
julia> @info "Macros are awesome" a
┌ Info: Macros are awesome
└ a = 10
julia> @debug "How awesome?" a
julia> using Logging; global_logger( ConsoleLogger(stderr, Logging.Debug) );
module LargeSparseArrays
import Base: size, getindex, setindex!
export LargeSparseArray
struct LargeSparseArray{T,N} <: AbstractArray{T,N}
d::Dict{CartesianIndex{N},T}
dims::NTuple{N,AbstractUnitRange{Int}}
function LargeSparseArray{T}(dims::Int...) where T
dim_ranges = Base.OneTo.(dims)
@mkitti
mkitti / napari.jl
Last active December 28, 2020 19:31
Invoking Napari from Julia Language 1.3.1
"""
napari.jl
Test using PyCall.jl to invoke Napari ( http://github.com/napari ) from
the Julia language ( https://julialang.org/ ) 1.3.1
Mark Kittisopikul
January 29th, 2020
"""
//rapidSquareROITool.ijm
//Creates six tools that allows you to quickly add either 64x64 or 32x32 square ROIs
//
// Mark Kittisopikul, September 11th, 2018
// Goldman Lab
// Northwestern University
//
// Tools:
// 1. Create a 64x64 px square ROI at the location clicked and add to ROI manager
// 2. Create a 32x32 px square ROI at the location clicked and add to ROI manager
@mkitti
mkitti / filtering_teaching.ipynb
Last active May 28, 2020 18:27
Teaching Filtering
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mkitti
mkitti / read_teaching.ipynb
Last active May 18, 2020 23:56
Basic Image Loading in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mkitti
mkitti / Manifest.toml
Last active March 26, 2020 08:42
SIR Notebook
# This file is machine-generated - editing it directly is not advised
[[AbstractTrees]]
deps = ["Markdown"]
git-tree-sha1 = "86d092c2599f1f7bb01668bf8eb3412f98d61e47"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.3.2"
[[Adapt]]
deps = ["LinearAlgebra"]
@mkitti
mkitti / MWE_JavaCall_async_incorrect.jl
Created February 17, 2020 00:15
JavaCall does not work well with @async
using JavaCall;
println("I threw a wish in the well ...")
JavaCall.init()
println("Hey, I just met you and this is crazy")
jls = @jimport java.lang.System
version = jcall(jls,"getProperty",JString,(JString,),"java.version")
println("Java Version: ",version)
jlm = @jimport java.lang.Math
@async begin
println("But here's my number, so call me maybe")
#@output Integer nFrames
//Sum_contour_lengths_by_frame_
//Mark Kittisopikul
//February 14th, 2020
//Install into Fiji.app/plugins/Scripts/Plugins/Curve Tracing/
//Companion to https://github.com/jalmar/CurveTracing
//Add up
importClass(Packages.ij.IJ);
importClass(Packages.ij.plugin.frame.RoiManager)