CenterForDigitalHumanities / SpectralRTI_Toolkit

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

Fitter file name requirement #56

Closed thehabes closed 5 years ago

thehabes commented 6 years ago

We found that on a mac, the file being named hshfitter crashed the program with the message that said "could not identify the type of fitter you are using". This is because

if (preferredFitter.equals("")) {
 //ask user to locate fitter
}
if (preferredFitter.endsWith("hshfitter.exe")) {
// do fitter stuff
}
else if (preferredFitter.endsWith("cmd")||preferredFitter.endsWith("bash")) {
// do fitter stuff
}
else if (preferredFitter.endsWith("PTMfitter.exe")) { // use PTM fitter
     IJ.error("Macro code to execute PTMfitter not yet complete. Try HSHfitter.");
     throw new Throwable("Macro code to execute PTMfitter not yet complete. Try HSHfitter."); 
} 
else {
     IJ.error("Problem identifying type of RTI fitter.  Please provide the hshfitter or deferred batch file.");
     throw new Throwable("Problem identifying type of RTI fitter");
}

The naming convention for the fitter either needs different logic or it should be stated somewhere clearly how it needs to be named.

thehabes commented 6 years ago

we could also change

if (preferredFitter.endsWith("hshfitter.exe")) {
// do fitter stuff
}

to

if (preferredFitter.endsWith("hshfitter.exe")||preferredFitter.endsWith("hshfitter")) {
// do fitter stuff
}

but then a directory named hshfitter would allow the program to continue but crash later on a "directory is not a file" error.

Domhnall101 commented 6 years ago

As bryan states, do we want to make the app agnostic to the file name? If we don't we need to add documentation to instruct user to name it correctly to make sure the user changes the file name extension of the fitter for mac (add .cmd or .bash) Secondary issue is accessing a HSH Fitter Right now the compressor is no longer available for free for Mac from Kacadu and this might also happen to the fitter.

thanneken commented 6 years ago

I think the best solution will require figuring out how HSHfitter is run on a Mac in a normal context. I don't have access to a Mac, but I can see that Cultural Heritage Imaging offers a Mac version of the software package that includes HSHfitter. http://culturalheritageimaging.org/What_We_Offer/Downloads/Process/index.html I can also see that the dmg file linked from there contains a couple of files or folders named HSHfitter:

./RTIbuilder-v2.0.2.app/Contents/Resources/Java/Fitters/HSHfitter
./RTIbuilder-v2.0.2.app/Contents/Resources/Java/Fitters/HSHfitter/hshfitter
./RTIbuilder-v2.0.2.app/Contents/Resources/Java/Fitters/HSHfitter/HSHfitter.dSYM
./RTIbuilder-v2.0.2.app/Contents/Resources/Java/Fitters/HSHfitter/HSHfitter.dSYM/Contents/Resources/DWARF/HSHfitter
./RTIbuilder-v2.0.2.app/Contents/Resources/Java/Plugins/HSHFitter
./RTIbuilder-v2.0.2.app/Contents/Resources/Java/Plugins/HSHFitter/HSHfitterPlugin.jar

I would be very surprised if the entire fitting can be run from a jar, but if one of those files is something like a mac executable we could have hshfitter (for Mac) and hshfitter.exe (for Windows and Wine) side by side and just figure out which one to use.

thehabes commented 5 years ago

Extension checking is done and adds extensions when necessary for mac, the filename can be whatever.