Skip to content

Instantly share code, notes, and snippets.

View andreped's full-sized avatar
🐛
busy making bugs to stay employed

André Pedersen andreped

🐛
busy making bugs to stay employed
View GitHub Profile
@tiagocardosos
tiagocardosos / python_ubuntu_docker.sh
Last active June 21, 2022 11:09
How to Install Python 3.6.* in Ubuntu 16.04 LTS - Docker
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6 libpython3.6
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo rm /usr/bin/python3
@Svidro
Svidro / !Coding helper scripts for QuPath
Last active December 10, 2024 00:34
Coding helper scripts for QuPath
Collections of scripts harvested mainly from Pete, but also picked up from the forums
If you are starting with 0.2.0m4+ START HERE: https://petebankhead.github.io/qupath/2019/08/21/scripting-in-v020.html
TOC
Access objects in other project images.groovy - in later versions of 0.2.0M#, access the hierarchies of other images
Access other project images or data.groovy
Access project metadata.groovy - interact with user defined, per image metadata. Useful for sorting projects.
@Svidro
Svidro / !Making Measurements in QuPath
Last active October 15, 2024 06:00
Making Measurements in QuPath
Collections of scripts harvested mainly from Pete, but also picked up from the forums
TOC
Accessing dynamic measurements.groovy - Most annotation measurements are dynamically created when you click on the annotation, and
are not accessible through the standard getMeasurement function. This is a way around that.
Affine transformation.groovy - access more accurate measurements for the affine transformation used in the image alignment (m5/m6+)
Alignment of local cells.groovy - check neighborhood for similarly aligned cells
@Svidro
Svidro / !Creating Objects in QuPath
Last active October 15, 2024 06:03
Creating objects in QuPath
Collections of scripts harvested mainly from Pete, but also picked up from the forums
TOC
Annotation subtraction example.groovy - An example of creating and subtracing ROIs through scripting
Create annotation of fixed size.groovy - see https://petebankhead.github.io/qupath/scripting/2018/03/09/script-create-fixed-size-region.html
Create object based on Viewer position.groovy - Creates an object at the Viewer position. In this case a rectangle. Useful if you want
to create the exact same size object multiple times and then move it to an area of interest for subsampling.
@Svidro
Svidro / !Selecting Objects in QuPath
Last active April 26, 2025 13:26
Selecting things in QuPath
Scripts mostly taken from Pete, and also from the forums. For easy access and reference.
Covers both Selecting, which is necessary to run most commands like cell detection, and collecting objects into a variable
for processing. The latter is more efficient when you do not need to run a command like cell detection.
TOC
A Selection guide.groovy - not actually a script, just a collection of useful tips.
Access top level objects.groovy - Creates a list of all objects at the "top" of the hierarchy. This list is dynamic.
Scripts mostly taken from Pete, and also from the forums. For easy access and reference.
TOC
Alignment: Several scripts to assist in alignment as of M9. Store scripts make files using the Affine transformation while
TransferObjects uses the stored file in the Affine folder with the current image name to move objects into it.
The final result is that one set of files can be generated for the transforms, and those transforms can be accessed to move objects
back and forth between the images.
Change annotations into Cell objects.groovy - Converts annotations into PathCellObjects, which allows certian functions to work within
@didacroyo
didacroyo / ftInceptionV3.py
Last active April 21, 2024 11:44
InceptionV3 Fine Tuning with Keras
# from the guide https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
# and from other resources found, trying to achieve a good classifier based on Inveption V3 pre-trained netfork
from keras.applications.inception_v3 import InceptionV3
from keras.preprocessing import image
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D
from keras.preprocessing.image import ImageDataGenerator
from keras import backend as K
from keras.callbacks import ModelCheckpoint
@you359
you359 / GuidedBackpropagation.py
Created August 22, 2018 04:59
Guided-Backpropagation
import keras
from keras.applications.vgg16 import VGG16
from keras.applications.vgg16 import preprocess_input, decode_predictions
from keras.preprocessing import image
import keras.backend as K
import tensorflow as tf
from tensorflow.python.framework import ops
import numpy as np
@SuperShinyEyes
SuperShinyEyes / f1_score.py
Created October 15, 2019 10:16
F1 score in PyTorch
def f1_loss(y_true:torch.Tensor, y_pred:torch.Tensor, is_training=False) -> torch.Tensor:
'''Calculate F1 score. Can work with gpu tensors
The original implmentation is written by Michal Haltuf on Kaggle.
Returns
-------
torch.Tensor
`ndim` == 1. 0 <= val <= 1
@rodydavis
rodydavis / flutter_github_ci.yml
Last active October 22, 2024 09:09
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web: