Created
April 2, 2021 18:00
-
-
Save tlancon/e14319e3c12629558c64533ba7c70746 to your computer and use it in GitHub Desktop.
Train a Weka model on multiple images by stacking slices from them together as a single stack. The stack is the same size in XY as the largest image, and all smaller images are padded with 0's to the lower-right corner to keep their original scale.
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
// Requirements: | |
// Trainable Weka Segmentation | |
// The list of files to use for training must be described in a text file, | |
// with each line containing the full path to one image. | |
listOfImages = File.openDialog("Choose a file with a list of images:"); | |
imagesString = File.openAsString(listOfImages); | |
images = split(imagesString, "\n"); | |
for (i=0; i<images.length; i++) { | |
open(images[i]); | |
} | |
// To simulate training a Weka model on multiple datasets, this set of images | |
// is stacked in ImageJ/FIJI before being passed to Weka. Empty space with voxels | |
// equal to 0 are padded to the bottom-right of the image as needed. | |
run("Images to Stack", "method=[Copy (top-left)] name=Training Set title=[] use"); | |
run("Trainable Weka Segmentation"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment