Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macro examples from OME 2020 NGFF workshop #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dgault
Copy link
Member

@dgault dgault commented May 28, 2020

Adding 3 new python macro examples and a groovy example.

This have been created for the OME 2020 workshop on next gen file formats. The goal of them is to show how to use tiled and pyramidal conversions to allow large plane (>2GB) images to be opened within the ImageJ environment.

The ImageJ Macro and plugins examples have typically lived in the bio-formats_plugins/utils folder. It would be good to start building a larger range of macro scripting examples in the

The one major outstanding issue with creating examples here is the ongoing testing implications for these macros.

@dgault dgault added this to the 6.6.1 milestone Dec 14, 2020
@dgault dgault removed this from the 6.6.1 milestone Mar 23, 2021
Copy link
Member

@jburel jburel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the support of Jython in Fiji, we rewrote all our omero training scripts in groovy
Only one script is in groovy. It might be better to only add groovy scripts

import ij.ImagePlus

// configuration
String file = "/path/to/inputFile.tiff"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Propose to let the user select the file to open

file = IJ.getFilePath("Choose a Tiff File")
if (file == null) {
	println "cancel"
	return
}

path = file.take(file.lastIndexOf('.'))
outFile = path + ".ome.tiff"

options.setId(outFile)
options.setSeriesOn(2, true)
ImagePlus[] imps = BF.openImagePlus(options)
imps[0].show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
imps[0].show()
imps[0].show()

options.setSeriesOn(2, True);
imps = BF.openImagePlus(options)
for imp in imps:
imp.show()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
imp.show()
imp.show()

import math

# configuration
file = "/path/to/inputFile.tiff"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file = IJ.getFilePath("Choose a Tiff File")
if file is None:
print("cancel")
sys.exit(2)

path = ('.').join(file.split('.')[:-1])
outFile = path + ".ome.tiff"

from ome.xml.model.primitives import PositiveInteger
from java.lang import Math
from ij import IJ
import math
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import math
import math
import sys

from ome.xml.model.primitives import PositiveInteger
from ome.units import UNITS
from java.lang import Math
from ij import IJ
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from ij import IJ
from ij import IJ
import sys

writer.saveBytes(0, downsample)

writer.close()
reader.close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reader.close()
reader.close()
IJ.log("Done")

from ome.xml.model.primitives import PositiveInteger
from java.lang import Math
from ij import IJ
import math
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import math
import math
import sys

import math

# configuation
file = "/path/to/inputFile.tiff"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file = IJ.getFilePath("Choose a Tiff File")
if file is None:
   print("cancel")
   sys.exit(2)

path = ('.').join(file.split('.')[:-1])
outFile = path + ".ome.tiff"

# close reader and writer
writer.close()
reader.close()
IJ.log("Done")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IJ.log("Done")
IJ.log("Done")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants