Skip to content

Instantly share code, notes, and snippets.

View justinrporter's full-sized avatar

Justin R. Porter justinrporter

  • Massachusetts General Hospital
  • Cambridge, MA
View GitHub Profile
@justinrporter
justinrporter / fix-keystone-calendar.py
Last active January 19, 2022 22:18
Make my mangled, Keystone-generated calendars fit for human consumption.
import datetime
# you can get this with 'pip install icalendar'
from icalendar import Calendar, vDate
# load a file called 'capstone.ics'
# you can get this by opening your calendar feed link in your browser
with open('capstone.ics','rb') as f:
cal = Calendar.from_ical(f.read())
cal_filtered = Calendar()

Keybase proof

I hereby claim:

  • I am justinrporter on github.
  • I am justinrporter (https://keybase.io/justinrporter) on keybase.
  • I have a public key whose fingerprint is 6C8A C5C7 63BE 2A16 3C7E 1172 4E3A 0389 DBFB 10A8

To claim this, I am signing this object:

@justinrporter
justinrporter / shape_match.py
Last active August 29, 2015 14:23
A configuration for ShapeDetectionLevelSetImageFilter that produces only a circle.
import itk
internal_type = itk.Image[itk.F, 3]
# output of the anisotropic diffusion-gradient magnitude-sigmoid filter
# pipeline used in many of the segmentation algorithms in the ITK docs
edge_potential = itk.ImageFileReader[internal_type].New()
edge_potential.SetFileName("out-sigmo.nii")
edge_potential.Update() # req'd so GetSpacing below works