CenterForDigitalHumanities / SpectralRTI_Toolkit

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

XS RGB stack required #15

Closed thehabes closed 6 years ago

thehabes commented 6 years ago

In XSRTI or XSRaking, if there is no selection for R, G or B the plugin breaks with a "Stack Required" error. If the user MUST select at least ONE image for each color channel, the UI should reflect this to gracefully handle a situation when R, G or B choices are not provided.

thehabes commented 6 years ago

Likewise if just 1 because that is not a stack either. Should this work with 1 or 0 selections for a given color band?

thanneken commented 6 years ago

Zero captures in any of the three categories would be silly and the user could be told as much. One in each category would be nearly pointless, but it is conceivable that one would have four captures and assign them to RRGB, or five and assign them to RRGBB. That is, a stack of zero should fail but a stack of one should not fail. With the data we have this would not be a problem if the guessing at defaults worked (different issue submitted on that).

thehabes commented 6 years ago

Great, that is what I needed to know. I will have a stab at it and see if I can fail gracefully when 0 selections are provided. I will look into why it fails on a selection of 1 and see if I can get around a stack being required.

If a stack (of at least 2) is required for the ImageJ command, perhaps I can make a stack of 2 of the same image (wasteful, but most likely unnoticeable and it won't throw off the algorithm).

thehabes commented 6 years ago

A small snag here. IJ.run(WindowManager.getImage("RedStack"),"PCA ", ""); Requires a stack to run. The stack is created by IJ.run("Image Sequence...", "title=[RedStack] open="+projectDirectory+"Captures-Narrowband-NoGamma"+File.separator+" file=("+redStringList+") sort"); The list is created by redStringList = redStringList+"|"+redNarrowbands[i].toString();

If an output is like Ambrosiana_A79inf_001v_MB940IR_014_F.tif| in the case of only one being designated 'R', this will not create a stack but rather a single image window.

If an output is like Ambrosiana_A79inf_001v_MB940IR_014_F.tif|Ambrosiana_A79inf_001v_MB940IR_014_F.tif where I try to cheat and add a duplicate second image to create a stack, it does not respect repeating file names and will only open a single image window.

This is the same for all color bands R, G and B. It seems the plugin requires the user to provide > 1 selection for each color band for this to run.

thehabes commented 6 years ago

I am sort of back to wondering what is best to do here...

What would be best to do with this Todd?

thanneken commented 6 years ago

In terms of user needs I can very much imagine a case when there is only one image for a color band, especially if there are only four or five captured total. In terms of implementation, another option that should work (if it is easier than duplicating the image into two slices) would be to invoke the ImageJ "Add slice" command. The second slice will be all black. PCA run on a meaningful slice and a meaningless slice will produce a first principal component identical (or extremely close) to the original slice.

thehabes commented 6 years ago

We will implement a way so the user must provide "at least 1 choice per light band". Consider this a bug for the moment given the requirement of 2 images per light band.

That's good to know about Add Slice, I will give that a try.

thehabes commented 6 years ago

Add slice doesn't appear to have negative side effects, but you should have the final say on that. This does the logic of tracking "at least 1 choice per light band" correctly and it stopped the crashes...if the output is still OK then this could be the fix.

thanneken commented 6 years ago

Yes. I tested to confirm that "add slice" does not have an adverse effect.