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

Adds log checkbox to GUI #22

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

abrewe
Copy link

@abrewe abrewe commented Jun 30, 2022

Log Checkbox is added on both EPICS_NTNDA_Viewer and EPICS_AD_Viewer. Selecting it takes log of the image, unchecking undoes it/turns it off.
logbox

logboxAD

Log checkbox uses built in ImageJ log function:

  • For 8-bit, new pixel value = log(pixelValue) * 255/log(255).

  • For 16-bit, new pixel value = log(pixelValue) * maxPixelValue/log(maxPixelValue), where maxPixelValue is the value of the maximum pixel value currently displayed.

  • For 32-bit, new pixel value = log(pixelValue). Plugin sets contrast to make new pixel values/image viewable.

Once the plugin is running/has been started, selecting another separate image in ImageJ (a Snap or other) and selecting the log checkbox will take the log of that image, according to the same rules above, and unchecking will undo the log.

Known Bugs/Cautions
Care must be taken when switching between taking the log of two different images. It is best to turn log off before switching between images, to avoid taking the log of an image twice on accident.

The log checkbox does not work well when attempting to turn the log display of individual slices of a stack on and off.

log checkbox by request of @antoninomiceli

@MarkRivers
Copy link
Member

I have done a quick test.

I have a few comments:

  • EPICS_NTNDA_Viewer compiles and runs OK.
  • However, EPICS_AD_Viewer fails to compile with these errors:
ImageJ 1.53k; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 146MB of 73726MB (<1%)
 
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\ImageJ\plugins\EPICS_areaDetector\EPICS_AD_Viewer.java:547: error: cannot find symbol
                if(dataType!= ScalarType.pvUShort && dataType!=ScalarType.pvUByte) resetContrast(img);
                              ^
  symbol:   variable ScalarType
  location: class EPICS_AD_Viewer
C:\ImageJ\plugins\EPICS_areaDetector\EPICS_AD_Viewer.java:547: error: cannot find symbol
                if(dataType!= ScalarType.pvUShort && dataType!=ScalarType.pvUByte) resetContrast(img);
                                                               ^
  symbol:   variable ScalarType
  location: class EPICS_AD_Viewer
2 errors
1 warning
  • I tested the performance. With the simDetector generating 50 frames/s, 1024 x 1024, UInt8 data type Int8 it displays 50 frames/s with and without Log enabled. However, with Int8 data type, so there are negative numbers, the data rate falls to 19 frames/s with Log enabled.

  • I found that the Snap function in log mode was not reliable. I often got images that looked like this, where the bottom portion of the image does not seem to have had the log applied.

image

  • If I have a nice looking contrast in linear mode, then when I switch to log mode it changes to look OK. However, when I go back to linear mode I no longer have the nice contrast I had set previously.

  • I don't like that fact that in log mode I cannot adjust the contrast at all. It constantly puts it back to auto. I think the user should be able to manual adjust the contrast in log mode after the initial auto setting.

@abrewe
Copy link
Author

abrewe commented Jul 11, 2022

EPICS_AD_Viewer should compile. Negative numbers should not cause such a drastic drop in frame rate now, but data rate for EPICS_AD_Viewer falls more than for EPICS_NTNDA_Viewer. Snap function is still unreliable with log, maybe because taking the log of each pixel takes too long and/or ImageProcessor is sometimes duplicated before it is completed? Not sure why, so for now snap button tells user to turn off log if snap button is selected. Contrast is adjustable in log mode.

@MarkRivers
Copy link
Member

I just pulled the latest commits. EPICS_AD_Viewer.java still does not compile for me:

ImageJ 1.53k; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 122MB of 73726MB (<1%)
 
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\ImageJ\plugins\EPICS_areaDetector\EPICS_AD_Viewer.java:791: error: local variable logCheckBox is accessed from within inner class; needs to be declared final
                        logCheckBox.setSelected(false);
                        ^
1 error
1 warning

And now EPICS_NTNDA_Viewer does not compile either:

ImageJ 1.53k; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 183MB of 73726MB (<1%)
 
warning: [options] bootstrap class path not set in conjunction with -source 1.6
C:\ImageJ\plugins\EPICS_areaDetector\EPICS_NTNDA_Viewer.java:802: error: local variable logCheckBox is accessed from within inner class; needs to be declared final
                        logCheckBox.setSelected(false);
                        ^
1 error
1 warning

Those errors were generated with ImageJ 1.53j on Windows.

I just updated to 1.53s and I get the same errors. What version of ImageJ are you using that does not generate these errors?

@abrewe
Copy link
Author

abrewe commented Jul 13, 2022

I'm using 1.53t.

@MarkRivers
Copy link
Member

MarkRivers commented Jul 13, 2022

I’m running on Windows. What are you using?

@MarkRivers
Copy link
Member

On Windows the latest version available is 1.53s. I just updated to the latest "Daily build" which is 1.53t30. That did not help, I get the same compile errors on both EPICS_AD_Viewer.java and EPICS_NTNDA_Viewer.java.

@abrewe
Copy link
Author

abrewe commented Jul 13, 2022

I'm running on Linux.

@abrewe
Copy link
Author

abrewe commented Jul 13, 2022

Does this commit do anything for the errors?

@MarkRivers
Copy link
Member

Yes, that fixed the errors in both EPICS_AD_Viewer.java and EPICS_NTNDA_Viewer.java.

I think that rather than disabling Snap in log mode it would be better to just snap an image without the log applied. The user can then simply do Process/Math/Log to apply the log if they want it.

@abrewe
Copy link
Author

abrewe commented Jul 13, 2022

Ok, sounds good.

@abrewe
Copy link
Author

abrewe commented Jul 15, 2022

Snap button snaps image without log applied.

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.

2 participants