Skip to content

Instantly share code, notes, and snippets.

View mcdlee's full-sized avatar

Sin-Di Lee mcdlee

View GitHub Profile
@mcdlee
mcdlee / avi2gif.sh
Last active December 10, 2015 22:18
#!/bin/bash
for i in *.avi
do
mplayer `echo $i` -vo gif89a:fps=15:output=`echo $i | sed 's/.avi/.gif/g'`
echo $i "succeed"
done
<html>
<head>
<title>檢查證明書</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<table style="border: 5px double rgb(0,0,0)">
<tr>
Persantin and side effect
========================================================
author: mcdlee
date: 2013-12
Background of patients
========================================================
```{r echo=FALSE}
library(ggplot2)
library(knitr)
@mcdlee
mcdlee / demo.Rmd
Created December 13, 2013 02:42
Demo in NUK (2013-12-12)
Demo in NUK (2013-12-12)
========================================================
```{r}
data <- read.csv("fake.csv")
data
attach(data)
```
@mcdlee
mcdlee / sinogram.py
Last active December 31, 2015 09:49
display sinogram of Thallium SPECT
import dicom
import pylab
ds = dicom.read_file("img.dcm") # read a dicom of pre-reconstructed SPECT
array = ds.pixel_array
y30 = array[:,30,:]
pylab.imshow(y30)
@mcdlee
mcdlee / reconstruction.py
Created January 2, 2014 06:40
Reconstruction of SPECT
import dicom
from skimage.transform import iradon
import pylab
import numpy
ds = dicom.read_file("img.dcm") # read a dicom of pre-reconstructed SPECT
array = ds.pixel_array
y36 = numpy.transpose(array[:,36,:]) #important!!
import dicom
from skimage.transform import iradon, iradon_sart
import pylab
import numpy
ds = dicom.read_file("img.dcm") # read a dicom of pre-reconstructed SPECT
array = ds.pixel_array
recon_3d = numpy.zeros((64,64,64))
@mcdlee
mcdlee / reconstructin_ROI.py
Last active January 2, 2016 11:08
1. Calculate count in given ROI. 2. Calculate parameter of certain ROI (chosen by threshold)
import dicom
from skimage.transform import iradon, iradon_sart
import numpy
import pylab
# readind data
ds = dicom.read_file("img.dcm") # read a dicom of pre-reconstructed SPECT
pixel_size= ds.PixelSpacing[1]/10 # read pixel size from header of dicom
print("Pixel size =", pixel_size, "cm")
pixel_volume= pixel_size**3
@mcdlee
mcdlee / PET_parsing.py
Last active October 21, 2021 06:22
PET/CT parsing to a Numpy 3D array
import dicom
import os
import numpy
import pylab
# readind data
ds = dicom.read_file("DICOMDIR") # read a dicomdir of PET/CT
# collect pixel_volume and resolution
@mcdlee
mcdlee / gist:8635698
Last active January 4, 2016 14:39
全省各家庭醫師整合性照護計畫院所查詢 -> csv
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 26 15:46:19 2014
@author: mcdlee
"""
from lxml import etree
import urllib2
import unicodedata