CenterForDigitalHumanities / SpectralRTI_Toolkit

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

Consult Preferences #86

Closed thanneken closed 5 years ago

thanneken commented 5 years ago

Every new user will start with no prefs file. In this circumstance the Consult Preferences dialog shows no default values. At least some should be easy. Some of these are already defaulted at other points, but the user won't know that and might try to find and complete all these fields before proceeding.

JP2 compressor. Will it accept a relative path if we bundle it? It would have to know whether it is running on Windows, Mac, Ubuntu, or Centos. JP2 arguments: The default values offered elsewhere should be offered here. HSH Fitter: We can bundle this too, although I think it will only work smoothly on Windows. JPEG Quality: Can we use a slider rather than a text box? People don't seem to agree whether the scale goes to 10 or 100. Let's set the default (whether slider or field) to 90. HSH Order: Default to 3 (candidate for removing other options) HSH Threads: Default to 16 (candidate for removing other options) WebRTI Maker: This too can be bundled, only simple on Windows.

I don't see any tooltips or help buttons. I think this would be a good place to explain (or link to an explanation) of what these are, when they are necessary, and how to get them.

It writes the following prefs file (Windows):

preferredCompress=C:/Program Files (x86)/Kakadu/kdu_compress.exe
preferredJp2Args=-rate -,2.4,1.48331273,.91673033,.56657224,.35016049,.21641118,.13374944,.08266171 Creversible=no Clevels=5 Stiles={1024,1024} Cblk={64,64} Cuse_sop=yes Cuse_eph=yes Corder=RPCL ORGgen_plt=yes ORGtparts=R Cmodes=BYPASS -double_buffering 10 -num_threads 4 -no_weights
preferredFitter=C:JavaApplicationsRTIbuilder_v2_0_2FittersHSHfitterhshfitter.exe
jpegQuality=90
hshOrder=0
hshThreads=0
webRtiMaker=
shortFileNames=true

The forward slashes in preferredCompress don't seem fatal, but the lack of any kind of separators in preferredFitter can't be good. It should be:

preferredFitter=C:\JavaApplications\RTIbuilder_v2_0_2\Fitters\HSHfitterhshfitter.exe
thehabes commented 5 years ago

If no prefs file is detected, the new one created for users will have the default values.

As for defaulting with a relative path for the preferences that are directories, we could do that and if bundled those default values would work. In the logic, the tests for those variables are

while(prefVar.equals("") || !prefFile.exists()) {
         OpenDialog dialog2 = new OpenDialog("Locate File");
          if(null==dialog2.getPath()){
                //@userHitCancel
                WindowManager.closeAllWindows();
                IJ.error("You must provide the file location to continue.  Exiting...");
                throw new Throwable("You must provide the file location to continue.");
           }
           prefVar = dialog2.getPath();
           prefFile = new File(prefVar);
}

so if we provide a default that does not exist OR use a blank, the plugin will know to ask for it when and while it needs it. I am leaving those directory preferences blank by default for now.

thehabes commented 5 years ago

I also notice that when I brought the preferences functionality over, it always assumed the preference file was in the base fiji folder.

We can move detection into the project folder so that each project can have its own preference file if that is desirable.

thehabes commented 5 years ago

Reviewed and fixed some behavior, check and see if this works closer to how you want.

thanneken commented 5 years ago

I deleted the old prefs file before running. I think it works well now. I'll add a bit more explanation to the documentation.