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

Update functions.html (IJ1 macro autocomplete in Fiji editor) #301

Closed
wants to merge 2 commits into from

Conversation

bvandenbroek
Copy link

Update for the IJ1 macro autocomplete functions in the Fiji editor.
The page is copied from the new location: https://wsr.imagej.net/developer/macro/functions.html

@ctrueden
Copy link
Member

@bvandenbroek Thanks for the update. I compared this against https://imagej.net/ij/developer/macro/functions.html, which is where I would expect to find the latest macro functions documentation, and there are a lot of differences. It does not look clear-cut to me which one is "better" either: although the wsr.imagej.net copy has a much newer "last updated" date, it also introduces many HTML validity errors (e.g. removal of quotes), removes many "Requires 1.52o" type comments from various function docstrings, and even removes docstrings for some functions such as Color.wavelengthToColor.

@rasband Could you please let us know which copy of functions.html is the canonical latest one? Then we can update the copy in this repository to reflect that, so that the Script Editor's autocompletion for ImageJ macros can function as smoothly as possible.

@ndefrancesco
Copy link
Contributor

Hi @ctrueden , @bvandenbroek, @rasband, and also @haesleinhuepf

Sorry for chiming in a little late to this PR, I just realized this was being discussed.

First, some context for my intervention: I was already working on a branch to update several functions for the IJ macro autocompletion, as well as some of the code that deals with the parsing of the html to generate the suggestions. This started being discussed in this image.sc post. This update also incorporated some changes related to Fiji script editor update introduced by that time. The last update I pushed to this branch can be found here. At some point discussion in the forum pointed at some issues with the lexer, which made me postpone the PR to see if I could understand their inner workings (way over my skill level), and perhaps include a change in that same update. This was a clear error by my part. I ran out of time at the moment, put the project on hold, and here I am a little more than a year latter trying to catch up to finally release the original PR.

Anyways, going back to this particular PR, I believe that the functions.html file in this library, which originally started as a copy of the website version, has slowly been diverging from that (irrespective of the addition of new functions), in order to accommodate for better parsing and entry disambiguation, and sometimes as a matter of style/html validity. One of the most important changes is the splitting of some anchor names (as in the case for close() being split into "close", "close2", "close3", "close4") to allow for multiple entries in the contextual suggestions**. Some other examples are: adding closing </p> tags that are missing, enclosing anchor names with quotes (and homogenizing to double quotes instead of single ones), remapping of internal anchors (like <a href="#IJ.renameResults">) to the full url paths, replacing HTML symbols ( like < for &lt;) etc. There are also minor edits and corrections (like adding a missing parameter to Roi.setGroup).

As a result of all this, I have the impression that it is not currently viable to just copy the latest version of the file that is being maintained by @rasband for the web.

I think the function of both files is different enough to afford maintaining separate versions, although it is true that updating the one from the library implies some regex-replacing+diffing to track changes (this is what I have been doing). Other option would be to incorporate all these changes into the web version, and maybe writing a function to correctly translate internal anchors on the fly.

What are your thoughts on this?

Cheers,
Nico

** in my branch I proposed a slight change, using "name_2" instead of "name2" to avoid a problem with atan2

@rasband
Copy link
Member

rasband commented Jul 28, 2023

The most up to date version of functions.html is at `
https://wsr.imagej.net/developer/macro/functions.html.
I updated the version at
https://imagej.net/ij/developer/macro/functions.html
so it is a duplicate. I added unique anchor names ('close_pattern', 'close_all', 'close_others') for the various close() functions. I can incorporate other changes and fixes as needed.

@ndefrancesco
Copy link
Contributor

@rasband Thanks for the quick reply

I gathered a (rather lengthy) list of changes that could be made to bring this two versions closer together. You can check the details below.

Click to expand

A search of the disambiguated entries in my current branch gives this full list:

name function
Array.show Array.show(array)
Array.show_2 Array.show("title", array1, array2, ...)
Array.sort Array.sort(array)
Array.sort_2 Array.sort(array1, array2, array3...)
call call("class.method", arg1, arg2, ...)
call_1 call("class.method")
close close()
close_2 close(pattern)
close_3 close("*")
close_4 close("\Others")
Color.set Color.set(string)
Color.set_2 Color.set(value)
Dialog.addImageChoice Dialog.addImageChoice(label)
Dialog.addImageChoice_2 Dialog.addImageChoice(label,defaultImage)
Dialog.addMessage Dialog.addMessage(string)
Dialog.addMessage_2 Dialog.addMessage(string, fontSize, fontColor)
Dialog.addString Dialog.addString(label, initialText)
Dialog.addString_2 Dialog.addString(label, initialText, columns)
Dialog.addNumber Dialog.addNumber(label, default)
Dialog.addNumber_2 Dialog.addNumber(label, default, decimalPlaces, columns, units)
Dialog.addCheckbox Dialog.addCheckbox(label, default)
Dialog.addCheckbox_2 Dialog.addCheckboxGroup(rows, columns, labels, defaults)
Dialog.addChoice Dialog.addChoice(label, items)
Dialog.addChoice_2 Dialog.addChoice(label, items, default)
doWand doWand(x, y)
doWand_2 doWand(x, y, tolerance, mode)
drawString drawString("text", x, y)
drawString_2 drawString("text", x, y, background)
eval eval(macro)
eval_2 eval("script", javascript)
eval_3 eval("js", script)
eval_4 eval("bsh", script)
eval_4 eval("python", script)
exit exit
exit_2 exit("error message")
File.openAsRawString File.openAsRawString(path)
File.openAsRawString File.openAsRawString(path, count)
Fit.doFit Fit.doFit(equation, xpoints, ypoints)
Fit.doFit_2 Fit.doFit(equation, xpoints, ypoints, initialGuesses)
Fit.getEquation Fit.getEquation(index, name, formula)
Fit.getEquation_2 Fit.getEquation(index, name, formula, macroCode)
getBoolean getBoolean("message")
getBoolean_2 getBoolean(message, yesLabel, noLabel)
getDir getDir(string)
getDir getDirectory("Choose a Directory")
getDirectory_1 getDirectory("plugins")
getDirectory_2 getDirectory("macros")
getDirectory_3 getDirectory("luts")
getDirectory_4 getDirectory("image")
getDirectory_5 getDirectory("imagej")
getDirectory_6 getDirectory("startup")
getDirectory_7 getDirectory("home")
getDirectory_8 getDirectory("downloads")
getDirectory_9 getDirectory("temp")
getDirectory_10 getDirectory("cwd")
getDirectory_11 getDirectory("preferences")
getInfo_1 getInfo(DICOM_TAG)
getInfo_2 getInfo("font.name")
getInfo_3 getInfo("image.description")
getInfo_4 getInfo("image.directory")
getInfo_5 getInfo("image.filename")
getInfo_5 getInfo("image.title")
getInfo_5 getInfo("image.subtitle")
getInfo_7 getInfo("log")
getInfo_8 getInfo("macro.filepath")
getInfo_9 getInfo("micrometer.abbreviation")
getInfo_10 getInfo("os.name")
getInfo_11 getInfo("overlay")
getInfo_12 getInfo("selection.name")
getInfo_14 getInfo("selection.color")
getInfo_15 getInfo("threshold.method")
getInfo_16 getInfo("threshold.mode")
getInfo_17 getInfo("window.contents")
getInfo_18 getInfo("window.title")
getInfo_19 getInfo("window.type")
getList-titles getList("image.titles")
getList-titles getList("window.titles")
getMetadata getMetadata("Info")
getMetadata_2 getMetadata("Label")
IJ.checksum IJ.checksum("MD5 string", string)
IJ.checksum_2 IJ.checksum("MD5 file", filepath)
IJ.renameResults IJ.renameResults(name)
IJ.renameResults_2 IJ.renameResults(oldName, newName)
Image.paste Image.paste(x, y)
Image.paste_2 Image.paste(x,y, mode)
indexOf indexOf(string, substring)
indexOf_2 indexOf(string, substring, fromIndex)
is is("animated")
is_2 is("applet")
is_3 is("area")
is_4 is("Batch Mode")
is_5 is("binary")
is_6 is("Caps Lock Set")
is_7 is("changes")
is_8 is("composite")
is_9 is("global scale")
is_10 is("grayscale")
is_11 is("Inverting LUT")
is_12 is("InvertY")
is_14 is("line")
is_15 is("locked")
is_16 is("Virtual Stack")
is_17 isActive(id)
isOpen isOpen(id)
isOpen_2 isOpen("Title")
List.setMeasurements List.setMeasurements
List.setMeasurements_2 List.setMeasurements("limit")
makeLine makeLine(x1, y1, x2, y2)
makeLine_2 makeLine(x1, y1, x2, y2, lineWidth)
makeLine_3 makeLine(x1, y1, x2, y2, x3, y3, ...)
makePoint makePoint(x, y, options)
makePoint_2 makePoint(x, y)
makeRectangle makeRectangle(x, y, width, height)
makeRectangle_3 makeRectangle(x, y, width, height, arcSize)
open open(path)
open open(path, n)
Overlay.setPosition Overlay.setPosition(n)
Overlay.setPosition_2 Overlay.setPosition(c, z, t)
Overlay.drawString Overlay.drawString("text", x, y)
Overlay.drawString Overlay.drawString("text", x, y, angle)
Overlay.addSelection Overlay.addSelection
Overlay.addSelection_2 Overlay.addSelection(strokeColor)
Overlay.addSelection_3 Overlay.addSelection(strokeColor, strokeWidth)
Overlay.addSelection_4 Overlay.addSelection("", 0, fillColor)
Overlay.fill Overlay.fill(color)
Overlay.fill_2 Overlay.fill(color1, color2)
parseInt parseInt(string)
parseInt parseInt(string, radix)
Plot.create Plot.create("Title", "X-axis Label", "Y-axis Label", xValues, yValues)
Plot.create_2 Plot.create("Title", "{cat1,cat2,cat3}", "Y-axis Label")
Plot.add Plot.add(type, xValues, yValues)
Plot.add_2 Plot.add(type, xValues, yValues, label)
Plot.setColor Plot.setColor(color)
Plot.setColor Plot.setColor(color1, color2)
Property.setSliceLabel Property.setSliceLabel(string, slice)
Property.setSliceLabel_2 Property.setSliceLabel(string)
random random
random_2 random("gaussian")
random_3 random("seed", seed)
Roi.setStrokeColor Roi.setStrokeColor(color)
Roi.setStrokeColor_2 Roi.setStrokeColor(red, green, blue)
Roi.setStrokeColor_3 Roi.setStrokeColor(rgb)
Roi.setFillColor Roi.setFillColor(color)
Roi.setFillColor_2 Roi.setFillColor(red, green, blue)
Roi.setFillColor_3 Roi.setFillColor(rgb)
Roi.setPosition Roi.setPosition(slice)
Roi.setPosition_2 Roi.setPosition(channel, slice, frame)
roiManager-add roiManager("add")
roiManager-add_2 roiManager("add & draw")
roiManager-select roiManager("select", index)
roiManager-select_2 roiManager("select", indexes)
RoiManager.rotate RoiManager.rotate(angle)
RoiManager.rotate_2 RoiManager.rotate(angle, xcenter, ycenter)
run run(command)
run_2 (command, options)
runMacro runMacro(name)
runMacro_2 runMacro(name, arg)
setAutoThreshold setAutoThreshold()
setAutoThreshold setAutoThreshold(method)
setBackgroundColor setBackgroundColor(r, g, b)
setBackgroundColor_2 setBackgroundColor(rgb)
setBatchMode setBatchMode(arg)
setBatchMode_2 setBatchMode("exit and display")
setBatchMode_3 setBatchMode("show")
setBatchMode_4 setBatchMode("hide")
setColor setColor(r, g, b)
setColor_2 setColor(value)
setColor_3 setColor(string)
setFont setFont(name, size[, style])
setFont_2 setFont("user")
setForegroundColor setForegroundColor(r, g, b)
setForegroundColor_3 setForegroundColor(rgb)
setLocation setLocation(x, y)
setLocation_2 setLocation(x, y, width, height)
setMetadata setMetadata("Info", string)
setMetadata_2 setMetadata("Label", string)
setMinAndMax setMinAndMax(min, max)
setMinAndMax_2 setMinAndMax(min, max, channels)
setOption setOption(option, boolean)
setOption_1a setOption(measurement, boolean)
setOption_1b setOption("AntialiasedText", boolean)
setOption_1c setOption("AutoContrast", boolean)
setOption_2 setOption("Bicubic", boolean)
setOption_3 setOption("BlackBackground", boolean)
setOption_4 setOption("Changes", boolean)
setOption_5 setOption("CopyHeaders", boolean)
setOption_5b setOption("DebugMode", boolean)
setOption_6 setOption("DisablePopupMenu", boolean)
setOption_7 setOption("DisableUndo", boolean)
setOption_9 setOption("ExpandableArrays", boolean)
setOption_9a setOption("FlipFitsImages", boolean)
setOption_9b setOption("InterpolateLines", boolean)
setOption_10 setOption("InvertY", boolean)
setOption_11 setOption("JFileChooser", boolean)
setOption_12 setOption("Loop", boolean)
setOption_13 setOption("OpenUsingPlugins", boolean)
setOption_14 setOption("QueueMacros", boolean)
setOption_15 setOption("ScaleConversions", boolean)
setOption_15a setOption("Show All", boolean)
setOption_16 setOption("ShowAngle", boolean)
setOption_17 setOption("ShowMin", boolean)
setOption_18 setOption("ShowRowNumbers", boolean)
setOption_19 setOption("ShowRowIndexes", boolean)
setOption_20 setOption("WaitForCompletion", boolean)
setOption_21 setOption("WandAllPoints", boolean)
setTool setTool(name)
setTool_1 setTool(id)
showMessage showMessage("message")
showMessage_2 showMessage("title", "message")
showProgress showProgress(progress)
showProgress_2 showProgress(currentIndex, finalIndex)
showText showText("string")
showText_2 showText("Title", "string")
String.join String.join(array)
String.join String.join(array, delimiter)
String.show String.show(str)
String.show_2 String.show(title, str)
substring substring(string, index1, index2)
substring_2 substring(string, index)
toScaled toScaled(x, y)
toScaled_2 toScaled(x, y, z)
toUnscaled toUnscaled(x, y)
toUnscaled_2 toUnscaled(x, y, z)
toString toString(number)
toString_2 toString(number, decimalPlaces)
waitForUser waitForUser(string)
waitForUser_2 waitForUser(title, message)

Additionally, an anchor should be included for this function

name function
Fit.doWeightedFit Fit.doWeightedFit(equation, xpoints, ypoints, weights, initialGuesses)

while these anchors should be added/updated using an underscore (instead of a space)

name function
roiManager-multi_measure roiManager("multi measure")
roiManager-multi-measure_append roiManager("multi-measure append")
roiManager-multi-measure_one roiManager("multi-measure one")
roiManager-multi_plot roiManager("multi plot")
roiManager-remove_slice_info roiManager("remove slice info")
roiManager-save_selected roiManager("save selected", file-path)

and the whole list of entries for getDir(string) should be duplicated for getDirectory(string), so that both entries are suggested (unless one of them is deprecated/not preferred).

Also, many references to the ImageJ version requirements are still missing:

function requires
Array.deleteValue(array, value) 1.52o
Array.deleteIndex(array, index) 1.52o
Array.sort(array1, array2, array3...) 1.52u
Array.rotate(array, d) 1.51n
Array.getVertexAngles(xArr, yArr, arm) 1.51n
Dialog.addMessage(string, fontSize, fontColor) 1.52q
Dialog.addToSameRow() 1.51r
File.getNameWithoutExtension(path) 1.52r
File.getDirectory(path) 1.52r
File.getDefaultDir 1.52s
File.setDefaultDir(directoryPath) 1.52s
getValue(x, y) 1.52p
getValue("rotation.angle") 1.52p
getValue("image.size") 1.52u
getValue("Mean, Median, Feret, etc.") 1.52p
is("area") 1.52m
is("line") 1.52m
makePoint(x, y, options) 1.52i
Overlay.selectable(false) 1.51r
Plot.add(type, xValues, yValues, label) 1.52q
Plot.addHistogram(values, binWidth, binCenter) 1.52f
Plot.setStyle(index, styleString) 1.52h
Plot.showValuesWithLabels() 1.52q
Roi.size 1.52r
Roi.setAntiAlias(boolean) 1.52p
Roi.getStrokeWidth 1.52r
Roi.setGroup(group) 1.52t
Roi.getGroup 1.52t
Roi.setDefaultGroup(group) 1.52t
Roi.getDefaultGroup 1.52t
Roi.getPosition(channel, slice, frame) 1.52r
Roi.getPointPosition(index) 1.52r
Stack.setUnits(X, Y, Z, Time, Value) 1.52r
Stack.getOrthoViews(x, y, z) 1.52r
Stack.getOrthoViewsIDs(XY, YZ, XZ) 1.52r
String.join(array) 1.52s
Table.setLocationAndSize(x, y, width, height) 1.52o

There other minor issues that could be corrected/improved, but this is already a long list to start with.



I feel like this is a lot of extra work that's unnecesarily falling upon you. That was the reason why I suggested keeping separate files, and offloading this burden to the ones contributing to/maintaining the autocompletion library. In this case, the html file in the library -for the lack of a better data format- could probably better be stripped of all the additional elements (headers, section links, letters, quote blocks, etc), so that it is clear that it's not just a copy of the web page.

However, if you still prefer updating the web file (either for use as a template to copy, or just for the sake of uniformity), is there a way to help you in doing this?

Also, if this is not the right place to discuss these issues, please let me know.

Thanks again.

@ctrueden
Copy link
Member

ctrueden commented Jul 30, 2023

@ndefrancesco @rasband I am in favor of one single source of truth for this information. Maybe the functions.html could be committed to the https://github.com/imagej/ImageJ repository, such that it gets bundled into ij.jar? It would be straightforward to make the pages served from https://imagej.net/ij/developer/macro/functions.html and https://wsr.imagej.net/developer/macro/functions.html stay in sync with this content via automation. And then here in imagej-legacy, the macro autocomplete could draw on the functions.html embedded in ij.jar rather than shipping its own. It would also allow the community to file pull requests to help with maintaining the content. What do you think?

@ndefrancesco
Copy link
Contributor

@ctrueden that'd be a really good solution! Then it'd be easy to modify the function parsing the entries to correctly redirect the embedded links to the right URL, so that the file maintains the right format to be served on the website(s).

@ndefrancesco
Copy link
Contributor

ndefrancesco commented Jul 31, 2023

@rasband, @ctrueden

I've worked on a proposal to merge the most important changes that I had identified into the current version of the functions.html file that @rasband is maintaining. You can check it in this repo: https://github.com/ndefrancesco/ImageJ-functions-doc-update.

I started from the current version online at https://wsr.imagej.net/developer/macro/functions.html, and incrementally made the suggested modifications, plus some extra ones I had ready to incorporate. I tried to make the commits as specific as possible, so that it is easy to track what I've done. These changes are stucturally minimal, so that the way the page is rendered should not have mostly changed.

If you consider these changes are acceptable, this could be a good starting point to work towards @ctrueden's idea. This should at least save @rasband some editing time.

Please, let me know what you think.

@rasband
Copy link
Member

rasband commented Aug 1, 2023

Hi @ndefrancesco, @ctrueden,

The merged functions.html file looks good so I added it to the ImageJ repository at

https://github.com/imagej/ImageJ/blob/master/functions.html

The commit does not appear on the list at

https://github.com/imagej/ImageJ/commits/master/ij

Is this because no files were changed?

I did not modify build.xml to copy functions.html to ij.jar. I would prefer not to add this 190kb file to the ij.jar distributed with ImageJ.

@ctrueden
Copy link
Member

ctrueden commented Aug 1, 2023

Thanks, @rasband!

The commit does not appear on the list at

https://github.com/imagej/ImageJ/commits/master/ij

Is this because no files were changed?

It's because no files in the ij directory were changed. You can see the commit if you change the URL to:

https://github.com/imagej/ImageJ/commits/master

i.e. drop the /ij directory filter from the commit listing.

I did not modify build.xml to copy functions.html to ij.jar. I would prefer not to add this 190kb file to the ij.jar distributed with ImageJ.

That is unfortunate, but I understand the reluctance. I will figure out how to bundle it into imagej-legacy.jar at the linked version of net.imagej:ij. Maybe the maven-remote-resources-plugin can do the job, I'll check.

Another option might be to download it on demand from https://imagej.net/ij/developer/macro/functions.html, although IIRC there was some performance reason that @haesleinhuepf did not originally want to do that... I guess because the network requests are too slow for autocomplete, and if we cache it then it can get out of sync as ij.jar evolves, so we would need to check at least once per JVM startup or daily or some such, whether the locally cached functions.html is still as new as the one being served online.

Regardless, I will need to create some server-side infrastructure to make this committed functions.html be the single source of truth aligned with https://wsr.imagej.net/developer/macro/functions.html and https://imagej.net/ij/developer/macro/functions.html. I can write a cron job that runs hourly and pulls the latest code from github.com/imagej/ImageJ.

@rasband What if I change https://imagej.net/ij/source/ not to be manually maintained, but rather just pulled from GitHub once an hour? Then I can symlink functions.html from there to the other locations.

@rasband
Copy link
Member

rasband commented Aug 1, 2023

I decided to include functions.html with ij.jar. It makes things simpler and the file is not that large after compression. I updated Jerome's FunctionFinder tool (cmd-shift-f in ImageJ's macro editor) to use this file. I also removed all the 'Requires 1.52x' strings. "Requires" is only intended to be used with recently added functions.

@rasband rasband closed this Aug 1, 2023
@rasband
Copy link
Member

rasband commented Aug 1, 2023

@ctrueden: “What if I change https://imagej.net/ij/source/ not to be manually maintained, but rather just pulled from GitHub once an hour? Then I can symlink functions.html from there to the other locations.”

Sounds like a good plan. The files in that directory have not been updated in 7 months.

@ctrueden
Copy link
Member

ctrueden commented Aug 3, 2023

I have reconfigured https://imagej.net/ij/source/ to automatically pull from GitHub once an hour.

There was another copy of the sources at https://imagej.net/ij/download/tools/source/, which I have now symlinked to /ij/source/.

I also reconfigured all existing copies of functions.html to symlink to https://imagej.net/ij/source/functions.html, so that when a new version is pushed to source control, all the URLs will serve it after the hourly sync happens.

All previous copies of the source code, and previous copies of functions.html, have been backed up to subfolders of https://wsr.imagej.net/backup/ as follows:

Old path Moved to
/ij/source/ /backup/source/ij/
/ij/download/tools/source/ /backup/source/ij-download-tools/
/ij/source/functions.html /backup/functions/ij-source/functions.html
/ij/developer/macro/functions.html /backup/functions/ij-developer-macro/functions.html
/developer/macro/functions.html /backup/functions/developer-macro/functions.html
/macros/functions.html /backup/functions/macros/functions.html
/temp/functions.html /backup/functions/temp/functions.html
/images.wsr.imagej.net/ /backup/images/wsr.imagej.net/
/images.mirror.imagej.net/ /backup/images/mirror.imagej.net/

These last two images folders were relocated for consistency with the other backed up files, so that they don't clutter the toplevel of https://wsr.imagej.net/

@ndefrancesco
Copy link
Contributor

ndefrancesco commented Aug 3, 2023

@ctrueden I'm currently working on a new version of the IJ macro autocompletion to incorporate these changes. I've already managed to load functions.html from ij.jar if available (currently only in the nigthly build). Would it be OK to also ship this updated version of the file with imagej-legacy.jar as a fallback in case ImageJ is not updated?

@ctrueden
Copy link
Member

ctrueden commented Aug 3, 2023

@ndefrancesco Oops, I was working on it also! I'll push the branch that I have.

@ctrueden
Copy link
Member

ctrueden commented Aug 3, 2023

@ndefrancesco OK, take a look at this:
https://github.com/imagej/imagej-legacy/compare/functions-html-from-ij

I got it far enough along to compile, but have not tested it whatsoever yet. But hopefully it illustrates what I'm thinking? It avoids shipping functions.html in imagej-legacy, in favor of reading it from ij, and falls back to reading it remotely if the version of ij.jar is too old.

If you have time to test it, I would appreciate it!

ndefrancesco added a commit to ndefrancesco/imagej-legacy that referenced this pull request Aug 3, 2023
This new version of the file is now also included in the ImageJ repo and served in the imagej.net web. Functions up to 1.54f are included.
The logic that parses new functions families (`Color.`, `Image.`, `Property.` and `RoiManager.`) as well as the one that resolves relative links to full URLs was updated to match the web version.

See this discussion:
imagej#301 (comment)
@ndefrancesco
Copy link
Contributor

@ctrueden Thanks for the update!

I had some time to test that branch. It seems to work fine using the web version of the html file if the ij.jar version is missing, but it's not picking it up when it's present. I guess it should be easy to solve (it works ok in the previous implementation) but I'm not entirely sure what's going on with this new one.

There is, anyway, an aspect of that approach that I would prefer avoiding. It is true that if ImageJ is up to date (in this moment, beyond the latest stable release), there will be no need to fetch any file from an external resource. But in the case that imagej-legacy is updated without updating ImageJ (which can certainly happen during the transition, and will happen due to other circumstances), there will be an absolute need for a live internet connection for it to work, and as there's no caching of the file, that would happen every time it's launched. I personally dislike that option, as it's quite limiting.

On the other hand, the cost of having a (probably redundant) copy of the file [~48k compressed] will ensure that any version of ImageJ prior to 1.54g will have an up to date (and beyond) autocompletion, and any new version will be as updated as possible, with no need for connectivity in any case.

I have prepared a new branch where I gathered a bunch of commits from my previous attempt (with changes that have been already tested) and some new ones regarding this new file, including some logic needed to correctly parse this version (relative links, new function families). You can check it out here: https://github.com/ndefrancesco/imagej-legacy/tree/autocompletion_2023
I tried to make the commit descriptions as clear as possible.

In this case, I took the route of keeping a static copy of the file as fallback. Anyway, I think that the rest of the changes are fitting irrespective of what's the final decision regarding the way to handle a possibly missing functions.html. There might be other issues that I could be missing that favor the first approach over the second.

Let me know what you think and how you suggest we move forward.

Thanks!

@imagesc-bot
Copy link

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/how-to-type-non-smart-quotation-marks-in-the-fiji-macro-editor/84909/3

@bvandenbroek
Copy link
Author

Hi @ctrueden @ndefrancesco @rasband,
Just wanted to thank you for picking this up so well!
I'm happy to test things from the user perspective. :-)

@imagesc-bot
Copy link

This pull request has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/remove-plots-or-fits-from-a-plot-profile-chart/54740/8

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.

5 participants