Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
B
bigStitcherMacros
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
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
gef
bigStitcherMacros
Commits
ff9bf37d
Commit
ff9bf37d
authored
Sep 21, 2018
by
janosch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fusion only script and fix filename script
parent
8020878c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
193 additions
and
43 deletions
+193
-43
fix_filenames_and_create_quickview.ijm
fix_filenames_and_create_quickview.ijm
+104
-0
generate_quickview_max_jpg.ijm
generate_quickview_max_jpg.ijm
+0
-40
stitch_a_day_macos.ijm
stitch_a_day_macos.ijm
+3
-2
stitch_a_day_windows.ijm
stitch_a_day_windows.ijm
+1
-1
stitch_a_day_windows_fusion_only1x.ijm
stitch_a_day_windows_fusion_only1x.ijm
+85
-0
No files found.
fix_filenames_and_create_quickview.ijm
0 → 100644
View file @
ff9bf37d
/*
* Macro template to process multiple images in a folder
*/
#@ File (label = "Input directory", style = "directory") input
#@ String (label = "File suffix", value = ".zip") suffix
setBatchMode(true);
processFolder(input);
print("Macro Done");
setBatchMode(false);
return;
// function to scan folders/subfolders/files to find files with correct suffix
function processFolder(input) {
fixFileNames(input);
list = getFileList(input);
list = Array.sort(list);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + File.separator + list[i]))
processFolder(input + File.separator + list[i]);
if(endsWith(list[i], suffix))
processFile(input, list[i]);
}
}
/*
* fixes file names
*/
function fixFileNames(input)
{
print("Fixing file names in: "+input);
//get prefix
imageSetArr = split(input, File.separator);
imageSetName = imageSetArr[ lengthOf(imageSetArr)-1 ];
//stupid windows bug needs removal of forward slashed
imageSetName = replace(imageSetName, "/", "");
//print(imageSetName);
list2 = getFileList(input);
list2 = Array.sort(list2);
for (i = 0; i < list2.length; i++) {
//print(list2[i]);
//only handle files with correct sufix starting with fused_
if(endsWith(list2[i], suffix) && startsWith(list2[i], "fused_") )
{
newName = input+File.separator+imageSetName+"_"+list2[i];
File.rename(input+File.separator+list2[i], newName);
print("renaming: "+list2[i]+" to "+ imageSetName+"_"+list2[i]);
//now set metadata
open(newName);
setMetadata("Label", ""+imageSetName+"_"+list2[i]);
//print("Label: "+ getMetadata("Label") );
save(newName);
close(imageSetName+"_"+list2[i]);
}
}
}
/*
* has 2 functions
* - create a max Z projection per File
* - if there are 2 channels present, creates max projects of the channel composite
*/
function processFile(input, file) {
if ( endsWith(file, "ch_1.tif.zip") )
{
imageSetArr = split(input, File.separator);
imageSetName = imageSetArr[ lengthOf(imageSetArr)-1 ];
imageSetName = replace(imageSetName, "/", "");
compositeMaxFileName = ""+input+File.separator+imageSetName+"_MAX_Composite.jpg";
if ( !File.exists(compositeMaxFileName))
{
open(input + File.separator + replace(file, "_ch_1", "_ch_0"));
open(input + File.separator + file);
imageTitles = getList("image.titles");
run("Merge Channels...", "c4="+imageTitles[1]+" c5="+imageTitles[0]);
resetMinAndMax();
run("Z Project...", "projection=[Max Intensity]");
resetMinAndMax();
saveAs("Jpeg", compositeMaxFileName);
close();
close();
}
}
targetFileName = ""+input + File.separator + file+".jpg";
if ( File.exists(targetFileName))
return;
print("Processing: " + input + File.separator + file);
open(input + File.separator + file);
run("Z Project...", "projection=[Max Intensity]");
saveAs("Jpeg",targetFileName );
close();
close();
}
generate_quickview_max_jpg.ijm
deleted
100644 → 0
View file @
8020878c
/*
* Macro template to process multiple images in a folder
*/
#@ File (label = "Input directory", style = "directory") input
#@ String (label = "File suffix", value = ".tif") suffix
// See also Process_Folder.py for a version of this code
// in the Python scripting language.
print("\\Clear");
processFolder(input);
print("Macro Done");
return;
// function to scan folders/subfolders/files to find files with correct suffix
function processFolder(input) {
list = getFileList(input);
list = Array.sort(list);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + File.separator + list[i]))
processFolder(input + File.separator + list[i]);
if(endsWith(list[i], suffix))
processFile(input, list[i]);
}
}
function processFile(input, file) {
targetFileName = ""+input + File.separator + file+".jpg";
if ( File.exists(targetFileName))
return;
print("Processing: " + input + File.separator + file);
open(input + File.separator + file);
run("Z Project...", "projection=[Max Intensity]");
saveAs("Jpeg",targetFileName );
close();
close();
}
stitch_a_day_macos.ijm
View file @
ff9bf37d
...
...
@@ -69,7 +69,7 @@ function processFile(input, output, file) {
//print(date);
//create dataset
run("Define dataset ...", "define_dataset=[Automatic Loader (Bioformats based)] exclude=10 bioformats_series_are?=Tiles bioformats_channels_are?=Channels move_tiles_to_grid_(per_angle)?=[Do not move Tiles to Grid (use Metadata if available)] how_to_load_images=[Load raw data virtually (with caching)] check_stack_sizes " +
run("Define dataset ...", "define_dataset=[Automatic Loader (Bioformats based)] exclude=10 bioformats_series_are?=Tiles bioformats_channels_are?=Channels move_tiles_to_grid_(per_angle)?=[Do not move Tiles to Grid (use Metadata if available)] how_to_load_images=[Load raw data virtually (with caching)] check_stack_sizes " +
"project_filename="+filename_without_suffix+".xml " +
"path=["+input+file+"] "+
"dataset_save_path=["+input+"]");
...
...
@@ -90,10 +90,11 @@ run("Define dataset ...", "define_dataset=[Automatic Loader (Bioformats based)]
File.makeDirectory(output+File.separator+specimen+File.separator+date);
File.makeDirectory(output+File.separator+specimen+File.separator+date+File.separator+filename_without_suffix);
print("created: "+outputPath);
//that might take a long time
run("Fuse dataset ...", "process_angle=[All angles] process_channel=[All channels] process_illumination=[All illuminations] process_tile=[All tiles] process_timepoint=[All Timepoints] bounding_box=[Currently Selected Views] downsampling=1 pixel_type=[16-bit unsigned integer] interpolation=[Linear Interpolation] image=[Precompute Image] blend preserve_original produce=[Each timepoint & channel] fused_image=[Save as (compressed) TIFF stacks] lossless "+
"select=["+xmlfile+"] "+
"output_file_directory=["+outputPath+"] ");
donefile = File.open(doneFileName);
File.close(donefile)
File.close(donefile)
;
}
stitch_a_day_windows.ijm
View file @
ff9bf37d
...
...
@@ -93,7 +93,7 @@ run("Define dataset ...", "define_dataset=[Automatic Loader (Bioformats based)]
"output_file_directory=["+outputPath+"] ");
donefile = File.open(doneFileName);
File.close(donefile)
File.close(donefile)
;
}
stitch_a_day_windows_fusion_only1x.ijm
0 → 100644
View file @
ff9bf37d
/*
* Author: Stephan Janosch, janosch@mpi-cbg.de, ORCID
*
*/
#@ File (label = "Input directory", style = "directory") input
#@ File (label = "Output directory", style = "directory") output
#@ String (label = "File suffix", value = ".tif") suffix
#@ String (label = "File stiching indicator", value = "_stitch_") filenameStitchCondition
// See also Process_Folder.py for a version of this code
// in the Python scripting language.
print("\\Clear");
processFolder(input);
print("Macro done");
return;
// function to scan folders/subfolders/files to find files with correct suffix
function processFolder(input) {
//skip folder Notes
if ( endsWith(input, "Notes/") )
return;
list = getFileList(input);
list = Array.sort(list);
print("Processing Folder: " + input);
for (i = 0; i < list.length; i++) {
if(File.isDirectory(input + File.separator + list[i]))
{
processFolder(input + File.separator + list[i]);
}
if(endsWith(list[i], suffix))
processFile(input, output, list[i]);
}
}
function processFile(input, output, file) {
//don't process files not intended for stitching
if (! matches(file, ".*"+filenameStitchCondition+".*"))
{
//print("Ignoring: " + input + File.separator + file);
return;
}
//be nice, don't redo Files already stitched
print("Processing: " + input + File.separator + file);
pathElements = split(input,File.separator);
date = split(pathElements[1], " ");
date=date[0];
specimen = pathElements[2];
doneFileName=input+File.separator+replace(file, suffix, "")+".macrodone";
filename_without_suffix = replace(file, suffix, "");
filename_without_suffix = replace(filename_without_suffix, filenameStitchCondition, "");
//print(input);
//print(filename_without_suffix);
//print(specimen);
//print(date);
//create dataset
xmlfile = input+filename_without_suffix+".xml";
outputPath = output+File.separator+specimen+File.separator+date+File.separator+filename_without_suffix+File.separator;
File.makeDirectory(output+File.separator+specimen);
File.makeDirectory(output+File.separator+specimen+File.separator+date);
File.makeDirectory(output+File.separator+specimen+File.separator+date+File.separator+filename_without_suffix);
print("created: "+outputPath);
run("Fuse dataset ...", "process_angle=[All angles] process_channel=[All channels] process_illumination=[All illuminations] process_tile=[All tiles] process_timepoint=[All Timepoints] bounding_box=[Currently Selected Views] downsampling=1 pixel_type=[16-bit unsigned integer] interpolation=[Linear Interpolation] image=[Precompute Image] blend preserve_original produce=[Each timepoint & channel] fused_image=[Save as (compressed) TIFF stacks] lossless "+
"select=["+xmlfile+"] "+
"output_file_directory=["+outputPath+"] ");
if ( !File.exists(doneFileName))
{
donefile = File.open(doneFileName);
File.close(donefile);
}
}
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