Skip to content

Instantly share code, notes, and snippets.

View shijianjian's full-sized avatar

Jian Shi shijianjian

  • KAUST
  • Saudi Arabia
View GitHub Profile
@shijianjian
shijianjian / OCT_data_ROI_seg.py
Last active September 29, 2020 06:51
Cirrus OCT ROI segmentation
"""Cirrus OCT ROI segmentation.
Author: Jian Shi
Email: sj8716643@126.com
"""
import numpy as np
import pandas as pd
import os
import cv2
@shijianjian
shijianjian / visual_3d.py
Last active September 6, 2020 06:21
Visualize 3D objects in a video manner
""" Visualize 3D objects in a video manner.
Current config is for Cirrus OCT only.
Author: Jian Shi
Email: sj8716643@126.com
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
@shijianjian
shijianjian / Heidelberg_dcm_to_png.py
Last active August 28, 2020 08:19
Extract images from Dicoms of Heidelberg OCT machine.
"""
Image extractor for Heidelberg OCT B-SCANS.
Author: Jian Shi
Date created: 28/08/2020
"""
from multiprocessing import Pool
import matplotlib.pyplot as plt
import pydicom
@shijianjian
shijianjian / np_tile_implementation.py
Created May 18, 2018 07:53
Manual Implementation for np.tile
import types
import numpy as np
def test_tile(x, multiplier):
x = np.array(x)
if isinstance(multiplier, list):
raise ValueError("multiplier must be a List or numpy array")
multiplier = np.array(multiplier)
if len(multiplier.shape) > 1:
@shijianjian
shijianjian / WirelessLogging.swift
Created May 10, 2018 20:51
Enable wireless logging on structure.io sensor.
// Enable logging as:
// if (WirelessLogging.DEBUG_MODE){
// WirelessLogging.shared.initRemoteLogging()
// }
// Logging as:
// WirelessLogging.log(message: "Success", log: "sensor", type: .debug)
import Foundation
import os.log
@shijianjian
shijianjian / hdf5_to_TFRecords.py
Last active March 31, 2023 17:05
Convert hdf5 file to TFRecords.
'''
This converter is used to convert hdf5 file to TFRecords.
Dataset used:
This is designed for the point cloud hdf5 data of pointnet,
which can be downloaded from https://github.com/charlesq34/pointnet/sem_seg
The sample data shape is
h5py {
'data': (1000, 4096, 9), # (number_of_data, points, channels)
import numpy as np
import cv2
import matplotlib.pyplot as plt
%matplotlib inline
'''
Read in image
'''
img = cv2.imread('./fruit_img.jpg', cv2.IMREAD_COLOR)
gray_img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) # use black and white for demostration
@shijianjian
shijianjian / tensorflow_self_check.py
Created October 11, 2017 14:00 — forked from mrry/tensorflow_self_check.py
TensorFlow on Windows self-check
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,