Last active
December 16, 2016 09:16
-
-
Save sbesson/3c9f27de36339b5f2ae03b21599b20d2 to your computer and use it in GitHub Desktop.
A set of scripts to manipulate Zeiss CZI options in Bio-Formats
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
% Check Bio-Formats and initialize logging | |
bfCheckJavaPath(); | |
bfInitLogging(); | |
% Create a reader | |
r = bfGetReader(); | |
values = [true false]; | |
for autostich = values | |
for attachments = values | |
% Create a set of key/value options and pass it to the reader | |
m = loci.formats.in.DynamicMetadataOptions(); | |
m.setBoolean(loci.formats.in.ZeissCZIReader.ALLOW_AUTOSTITCHING_KEY,... | |
java.lang.Boolean(autostich)); | |
m.setBoolean(loci.formats.in.ZeissCZIReader.INCLUDE_ATTACHMENTS_KEY,... | |
java.lang.Boolean(attachments)); | |
r.setMetadataOptions(m); | |
for flattenedResolutions = values | |
r.setFlattenedResolutions(flattenedResolutions); | |
% Initialize the reader with the file | |
r.setId(path_to_czi); | |
% Display metadata | |
fprintf(1, 'Autostitch: %g\n', autostich); | |
fprintf(1, 'Include attachments: %g\n', attachments); | |
fprintf(1, 'Flatten resolutions: %g\n', flattenedResolutions); | |
fprintf(1, 'Number of series: %g\n', r.getSeriesCount()); | |
fprintf(1, 'Number of resolutions: %g\n', r.getResolutionCount()); | |
fprintf(1, '\n'); | |
% Close the reader | |
r.close(); | |
end | |
end | |
end |
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
// A macro derived from basicMetadata to set the CZI arguments | |
// Set option to disable auto-stitching and attachments | |
call("ij.Prefs.set", "bioformats.zeissczi.allow.autostitch", "false"); | |
call("ij.Prefs.set", "bioformats.zeissczi.include.attachments", "false"); | |
run("Bio-Formats Macro Extensions"); | |
id = File.openDialog("Choose a file"); | |
Ext.setId(id); | |
Ext.getSeriesCount(seriesCount); | |
for (s=0; s<seriesCount; s++) { | |
Ext.setSeries(s); | |
Ext.getSizeX(sizeX); | |
Ext.getSizeY(sizeY); | |
Ext.getSizeZ(sizeZ); | |
Ext.getSizeC(sizeC); | |
Ext.getSizeT(sizeT); | |
print("Series #" + s + ": image resolution is " + sizeX + " x " + sizeY); | |
print("Focal plane count = " + sizeZ); | |
print("Channel count = " + sizeC); | |
print("Time point count = " + sizeT); | |
} | |
Ext.close(); |
Thanks @bramalingam, done in 3c9f27de36339b5f2ae03b21599b20d2 and added the flattened resolutions call.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Both the scripts work. The only thing that I might like to add to the matlab script is a loop like the Fiji example, to print the series count etc. Then it would become a self-sufficient example and potentially a base script for a unit-test in future.