This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.metrics import roc_curve, precision_recall_curve, auc, average_precision_score | |
from sklearn.model_selection import train_test_split | |
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.metrics import roc_auc_score | |
import pandas as pd | |
import pickle | |
#read in files | |
X_tumor = pd.read_csv('/home/wzli/Downloads/PF_parameter_MethodII_no_norm/data_sheet_for_random_forest_16_strike_tumor_9_0502_Method_II_no_norm.csv') | |
X_normal = pd.read_csv('/home/wzli/Downloads/PF_parameter_MethodII_no_norm/data_sheet_for_random_forest_16_strike_normal_9_0502_Method_II_no_norm.csv') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
#If you need more information about how ElementTree package handle XML file, please follow the link: | |
#https://docs.python.org/3/library/xml.etree.elementtree.html | |
#import multiresolutionimageinterface as mir | |
import matplotlib.pyplot as plt | |
import cv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
#If you need more information about how ElementTree package handle XML file, please follow the link: | |
#https://docs.python.org/3/library/xml.etree.elementtree.html | |
#import multiresolutionimageinterface as mir | |
import matplotlib.pyplot as plt | |
import cv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import multiresolutionimageinterface as mir | |
import matplotlib.pyplot as plt | |
import os.path as osp | |
import openslide | |
import matplotlib.pyplot as plt | |
from pathlib import Path | |
import glob | |
import re | |
#please make sure the same number of files in the folder of tumor file and folder of annotation files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.callbacks import Callback | |
import keras.backend as K | |
import numpy as np | |
class SGDRScheduler(Callback): | |
'''Cosine annealing learning rate scheduler with periodic restarts. | |
# Usage | |
```python | |
schedule = SGDRScheduler(min_lr=1e-5, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.misc import imread, imresize | |
from keras.layers import Input, Dense, Convolution2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, merge, Reshape, Activation | |
from keras.models import Model | |
from keras.regularizers import l2 | |
from keras.optimizers import SGD | |
from googlenet_custom_layers import PoolHelper,LRN | |
def create_googlenet(weights_path=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import multiresolutionimageinterface as mir | |
import matplotlib.pyplot as plt | |
import os.path as osp | |
import openslide | |
import matplotlib.pyplot as plt | |
from pathlib import Path | |
import glob | |
#please make sure the same number of files in the folder of tumor file and folder of annotation files | |
#please change the slide_path, anno_path, mask_path accordingly, and leave everything else untouched. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import multiresolutionimageinterface as mir | |
import matplotlib.pyplot as plt | |
reader = mir.MultiResolutionImageReader() | |
mr_image = reader.open('/home/wli/Downloads/tumor_009.tif') | |
# dims=mr_image.getLevelDimensions(6) | |
# tile = mr_image.getUCharPatch(0, 0, dims[0], dims[1], 6) | |
# plt.imshow(tile) | |
# plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import multiresolutionimageinterface as mir | |
import matplotlib.pyplot as plt | |
import cv2 | |
import numpy as np | |
reader = mir.MultiResolutionImageReader() | |
mr_image = reader.open('/home/wli/Downloads/tumor_036.tif') | |
Ximageorg, Yimageorg = mr_image.getDimensions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I did this under python3.5, which is the default version for python3 in Ubuntu | |
sudo apt-get install python3-tk | |
sudo apt-get install libpython3.6-dev | |
pip3 install matplotlib numpy | |
then download ASAP from the website: https://github.com/computationalpathologygroup/ASAP/releases |