CenterForDigitalHumanities / SpectralRTI_Toolkit

Process Spectral RTI Images in ImageJ
GNU General Public License v3.0
1 stars 0 forks source link

Deferred Batch #26

Closed thanneken closed 6 years ago

thanneken commented 6 years ago

The interface correctly asks the user to locate the HSH Fitter or a deferredbatch.cmd file. It proceeds fine with hshfitter.exe, but fails with deferredbatch.cmd. The console shows the error:

[INFO] D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\AccurateColorRTI\Ambrosiana_C73inf_062_AccurateColorRTI.lp does not exist, it is a safe name to save as
[INFO] Running the fitter for AccurateColor...
Apr 02, 2018 12:51:58 PM com.slu.imagej.SpectralRTI_Toolkit run
SEVERE: null
java.nio.file.NoSuchFileException: D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\AccurateColorRTI\Ambrosiana_C73inf_062_AccurateColorRTI_20180402_1243.txt

(and indeed there is no such file)

Running the HSHFitter is very time consuming, so the deferredbatch.cmd file should be even more useful for troubleshooting than it is in normal operation.

thanneken commented 6 years ago

The results above were on Windows 10 and a non-empty deferredbatch.cmd file.

thanneken commented 6 years ago

The deferred batch is pretty simple but very helpful. Instead of executing a command with its arguments, it appends that command with its arguments to a text file that can be run overnight, or on a different machine, or in a different environment (such as Wine on Linux).

The procedure is to ask the user to locate the hshfitter OR the batch file. The plugin then discerns whether it is the exe file or something else. The plugin currently supports the exe scenario. The alternate scenario is to write "hshfitter.exe" and the arguments to the file. I have been using deferredbatch.cmd. I think .bat should work too, but I'm not sure about MacOS.

So far we are assuming that the machine that runs the deferredbatch.cmd has hshfitter.exe in its path (or the first line of the .cmd file adds it to the path). I suppose one UI alternative is to ask the user where the hshfitter.exe file is, and also whether it should be run now or later. That would assume the machine is the same, but overall I would call that an improvement. Maybe the "locate hshfitter.exe" could be cancellable and then just use hshfitter.exe without the path. It might be cleaner to have one line setting the path, but it should also work to let each line have the full path to hshfitter.exe.

Note that all this goes for webGLRTIMaker.exe as well as hshfitter.exe.

An example deferredbatch.cmd file might look like this:

path=%path%;Z:\home\thanneken\wine\HSHfitter;Z:\home\thanneken\wine\webRTI;Z:\home\thanneken\wine\PTMfitter
hshfitter D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\AccurateColorRTI\Ambrosiana_C73inf_062_AccurateColorRTI.lp 3 16 D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\AccurateColorRTI\Ambrosiana_C73inf_062_AccurateColorRTI_20180402_1144.rti
webGLRTIMaker D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\AccurateColorRTI\Ambrosiana_C73inf_062_AccurateColorRTI_20180402_1144.rti -q 100 -r 8192
hshfitter D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\ExtendedSpectrumRTI\Ambrosiana_C73inf_062_ExtendedSpectrumRTI.lp 3 16 D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\ExtendedSpectrumRTI\Ambrosiana_C73inf_062_ExtendedSpectrumRTI_20180402_1144.rti
webGLRTIMaker D:\Projects\Ambrosiana_C73inf\Ambrosiana_C73inf_062\ExtendedSpectrumRTI\Ambrosiana_C73inf_062_ExtendedSpectrumRTI_20180402_1144.rti -q 100 -r 8192
thehabes commented 6 years ago

The runFitter() portion now discerns between deferred batch vs fitter. However, if the preferred fitter is the hshFitter and it is remembered, the user does not get the option to switch to deferred batch. We will discuss this in our UI/UX review and maybe force a confirmation interrupt at the right moment.

thehabes commented 6 years ago

This is now implemented. However, I notice a point for possible improvement.

In my test, the deferred batch is outputting

hshfitter E:\BJH_macroResult\Projects\BraynTest3\AccurateColorRTI\BraynTest3_AccurateColorRTI.lp 3 16 E:\BJH_macroResult\Projects\BraynTest3\AccurateColorRTI\BraynTest3_AccurateColorRTI_20180426_1104.rti

webGLRTIMaker E:\BJH_macroResult\Projects\BraynTest3\AccurateColorRTI\BraynTest3_AccurateColorRTI_20180426_1104.rti -q 100 -r 8192

Initially, I thought the string hshfitter and webGLRTIMaker were errors. I know the path location of these items at this point in the code, so I thought it would be outputting the path. I come to find that those strings are hard coded into what is written to the deferred batch, which is what the macro does so it was brought over successfully.

If those items are running as a service, these commands will work outright. If they do not work, they will give an appropriate error like "hshfitter not found here", which will clue the user into cd'ing to the correct directory OR replacing the string with the path.

Would it be beneficial to include the whole path instead of the string so the output looks like

E:/path/to/hshfitter.exe E:\BJH_macroResult\Projects\BraynTest3\AccurateColorRTI\BraynTest3_AccurateColorRTI.lp 3 16 E:\BJH_macroResult\Projects\BraynTest3\AccurateColorRTI\BraynTest3_AccurateColorRTI_20180426_1104.rti

E:/path/to/webGLRtiMaker.exe E:\BJH_macroResult\Projects\BraynTest3\AccurateColorRTI\BraynTest3_AccurateColorRTI_20180426_1104.rti -q 100 -r 8192

Any answer is OK, I am just trying to gauge the intention here.

thanneken commented 6 years ago

This is what I was getting at in the paragraph above that starts, "So far we are assuming that the machine..."

As an advanced user, I often run the deferred batch on a different machine or in a different environment (wine). This might be a case when we differentiate between the basic user who defers until later on the same machine and the advanced user. I do think we should consider MacOS users as part of our target audience. Maybe we should have the option to browse to hshfitter.exe even if we are going to defer running it, or typing in what the path will be. That would at keep us within the principle of not asking users to edit text files. On the other hand, if reasonably well documented it doesn't seem unreasonable to ask users to add a path to their path environment variable.

thehabes commented 6 years ago

We will move this into the UI Review process. In general, deferred batch is working now.