Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
L
lecture_applied_bioimage_analysis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rhaase
lecture_applied_bioimage_analysis
Commits
4624726c
Commit
4624726c
authored
Apr 28, 2019
by
rhaase
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial version examples for ImageJ macro
parent
b35e6247
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
225 additions
and
0 deletions
+225
-0
05_example_code_and_data/analyse_banana.ijm
05_example_code_and_data/analyse_banana.ijm
+43
-0
05_example_code_and_data/arrays.ijm
05_example_code_and_data/arrays.ijm
+27
-0
05_example_code_and_data/banana.zip
05_example_code_and_data/banana.zip
+0
-0
05_example_code_and_data/csv_test.py
05_example_code_and_data/csv_test.py
+14
-0
05_example_code_and_data/first_example.ijm
05_example_code_and_data/first_example.ijm
+9
-0
05_example_code_and_data/good_comments.ijm
05_example_code_and_data/good_comments.ijm
+20
-0
05_example_code_and_data/good_comments.py
05_example_code_and_data/good_comments.py
+20
-0
05_example_code_and_data/image_statistics.ijm
05_example_code_and_data/image_statistics.ijm
+13
-0
05_example_code_and_data/process_folder.ijm
05_example_code_and_data/process_folder.ijm
+12
-0
05_example_code_and_data/read_image_properties.ijm
05_example_code_and_data/read_image_properties.ijm
+15
-0
05_example_code_and_data/rounding_assay.zip
05_example_code_and_data/rounding_assay.zip
+0
-0
05_example_code_and_data/string_variables.ijm
05_example_code_and_data/string_variables.ijm
+11
-0
05_example_code_and_data/troubleshooting_tracing.ijm
05_example_code_and_data/troubleshooting_tracing.ijm
+10
-0
05_example_code_and_data/variables.ijm
05_example_code_and_data/variables.ijm
+10
-0
05_example_code_and_data/yin_yang.ijm
05_example_code_and_data/yin_yang.ijm
+21
-0
No files found.
05_example_code_and_data/analyse_banana.ijm
0 → 100644
View file @
4624726c
// This ImageJ macro analyses a folder of 2D MRI
// images showing a banana slice by slice. It measures
// the position of the banana and writes it in a CSV file.
//
// Usage: run it in Fiji (http://fiji.sc)
//
// Robert Haase, MPI CBG, rhaase@mpi-cbg.de
// April 2019
//
folder = "C:/structure/teaching/lecture_applied_bioimage_analysis/05_example_data/banana/"
// access the folder
filelist = getFileList(folder);
for (i = 0; i < lengthOf(filelist); i++) {
// get the nth entry from the filelist array
file = filelist[i];
if (endsWith(file, ".tif")) {
// open the image
open(folder + file);
// segment the object in the image
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");
run("Fill Holes");
// measure the position of this one single object
run("Set Measurements...", "centroid redirect=None decimal=3");
run("Create Selection");
run("Measure");
// close the image
close();
}
}
// save the positions as CSV to disc
result_filename = "Position.csv"
saveAs("Results", folder + result_filename);
05_example_code_and_data/arrays.ijm
0 → 100644
View file @
4624726c
// numeric arrays
v = newArray(3, -4, 0);
Array.print(v);
// create an array with three elements containing zeros
v = newArray(3);
Array.print(v);
// manipulate arrays
v[0] = 3.5
Array.print(v);
// access array elements
print( v[2] );
// string arrayss
animals = newArray("dog", "cat", "mouse");
// combining arrays
mixed = Array.concat(v, animals);
Array.print(mixed);
// get length of an array
numberOfElements = lengthOf(v);
print("v has " + numberOfElements + " elements");
05_example_code_and_data/banana.zip
0 → 100644
View file @
4624726c
File added
05_example_code_and_data/csv_test.py
0 → 100644
View file @
4624726c
import
csv
with
open
(
"test.csv"
,
newline
=
''
)
as
csvfile
:
reader
=
csv
.
reader
(
csvfile
,
delimiter
=
','
)
linecount
=
0
;
for
row
in
reader
:
if
(
linecount
>
0
):
print
(
"The square of "
+
row
[
0
]
+
" is "
+
row
[
1
]);
linecount
=
linecount
+
1
05_example_code_and_data/first_example.ijm
0 → 100644
View file @
4624726c
//
// This program is our first example
//
// Author: Robert Haase, MPI-CBG,
// rhaase@mpi-cbg.de
// July 2015
print("Hello world");
05_example_code_and_data/good_comments.ijm
0 → 100644
View file @
4624726c
// This program is our second example.
// It sums up two numbers.
//
// Usage:
// * Run it in FIJI (www.fiji.sc)
//
// Author: Robert Haase, MPI CBG,
// rhaase@extern.mpi-cbg.de
// July 2016
// initialise program
a = 1;
b = 2.5;
// run complicated algorithm
final_result = a + b;
print( final_result );
05_example_code_and_data/good_comments.py
0 → 100644
View file @
4624726c
#
# This program sums up two numbers.
#
# Usage:
# * Run it in Python (python.org)
#
# Author: Robert Haase, MPI CBG,
# rhaase@mpi-cbg.de
# April 2019
# initialise program
a
=
1
b
=
2.5
# run complicated algorithm
final_result
=
a
+
b
# print the final result
print
(
final_result
)
05_example_code_and_data/image_statistics.ijm
0 → 100644
View file @
4624726c
// initialise program
imageFilename = "blobs.gif";
open( imageFilename );
// get image statistics
getStatistics(area, mean, min, max, std);
// show results
print("The grey value ranges from " + min + " to " + max + ". ");
print("It has an average of " + mean + " +- " + std + ". ");
close();
05_example_code_and_data/process_folder.ijm
0 → 100644
View file @
4624726c
// initialise program
foldername = "/Users/rhaase/temp/";
// get all files in the folder as list
list = getFileList( foldername );
// print out the list; item by item
for (i = 0; i < list.length; i++) {
filename = list[i];
print( filename );
}
05_example_code_and_data/read_image_properties.ijm
0 → 100644
View file @
4624726c
// initialise program
imageFilename = "blobs.gif";
open( imageFilename );
// read image properties
width = getWidth();
height = getHeight();
getPixelSize(unit, pixelWidth, pixelHeight);
// show results
print("The image is " + width + " times " + height + " pixels wide");
print("Each pixels has a size of " + pixelWidth +
" times " + pixelHeight + " " + unit + "^2");
close();
05_example_code_and_data/rounding_assay.zip
0 → 100644
View file @
4624726c
File added
05_example_code_and_data/string_variables.ijm
0 → 100644
View file @
4624726c
// initialise program
firstname = "Robert";
lastname = "Haase";
// run complicated algorithm
name = firstname + " " + lastname;
// show the result
print("Hello " + name + "!");
05_example_code_and_data/troubleshooting_tracing.ijm
0 → 100644
View file @
4624726c
start = 0;
end = 10;
// print numbers
for ( i = start; i < end; i++ ) {
if (i > 5) {
print(i);
}
}
05_example_code_and_data/variables.ijm
0 → 100644
View file @
4624726c
// initialise program
a = 1;
b = 2.5;
// run complicated algorithm
c = a + b;
// show the result
print(c);
05_example_code_and_data/yin_yang.ijm
0 → 100644
View file @
4624726c
// initialise program
a = 5;
b = 3;
c = 8;
// execute algorithm
d = (a + b) / c;
// evaluate result
if (b > 0) {
if (a == 5) {
print("Yin");
}
else {
if (c < 5) {
}
}
if (d != 0) {
print("Yang");
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment