Bruker-Amics / bugs_features

3 stars 0 forks source link

Flat-Field Correction #100

Open Matt-Power opened 3 years ago

Matt-Power commented 3 years ago

I'm sure this is on the list already but correction of uneven brightness across each frame would be really, really useful, especially when running at low-ish magnification and a larger aperture (great for beam current but produces horrible vignetting and / or brightness gradients). BSE adjustment has been applied to the example below but the gradation across the image is really severe.

image

It would really complement the BSE by-frame adjustment (which is excellent).

knapp-amics commented 3 years ago

We have a plan to revisit image tools, particularly image stich and blend, later. We need to do some real R&D to make sure we get this right. It's more than just a tweak.

I think that the best approach may be a separate utility that allows for image adjustment, stich, stack, etc. as a plug-in.

So, I am working in that. I'll close this issue because it is a duplicate of a whole set that are planned for the future.


From: Matt-Power @.> Sent: Thursday, August 19, 2021 11:18:58 PM To: Bruker-Amics/bugs_features @.> Cc: Subscribed @.***> Subject: [Bruker-Amics/bugs_features] Flat-Field Correction (#100)

EXTERNAL EMAIL

I'm sure this is on the list already but correction of uneven brightness across each frame would be really, really useful, especially when running at low-ish magnification and a larger aperture (great for beam current but produces horrible vignetting and / or brightness gradients). BSE adjustment has been applied to the example below but the gradation across the image is really severe.

[image]https://user-images.githubusercontent.com/84986921/130178064-13dbe4b4-d5e1-462c-b17b-48bc968ec53a.png

It would really complement the BSE by-frame adjustment (which is excellent).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Bruker-Amics/bugs_features/issues/100, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUCMQ3FLXIAVRHMUQW22KHDT5XJTFANCNFSM5CPQ525Q.

jkabel commented 2 years ago

I've been thinking a bit about this one. Is the vignetting still present at longer working distances? The 10mm analytical working distance (in the SU3900/Quanta) is somewhat arbitrary. Systems with AMICS installed could be issued the Bruker variable Z flange adapters for the EDS and optimized for a 15/20mm WD. That would increase the low magnification operating envelope before lens distortions creep in, let the EDS detectors be jammed a little closer to the sample, and minimize the vignetting as while the absolute solid angle to the BSE detector would be reduced, the variability of the solid angle would also be reduced. We operate in high current conditions anyway, there're plenty of electrons to go around.

Matt-Power commented 2 years ago

That's a bit creepy - was thinking about the same issue when your comment popped up! I think that there are two parts to this - the vignetting and the grey scale gradient across the image. For the vignetting, this image was actually acquired at 20 mm (with the variable Z adjusted to maximise the count rate). It is still present at these longer working distances but much better than at say ~10 mm. Even at 20 mm though, the mag is limited to about 50 to 60 X - any lower and it gets too bad. Not a disaster but it does mean longer run times due to the time overheads for each frame (it is way quicker to measure at high resolution / low mag than vice versa). For the gradient, this seems to be down to beam alignment (easy enough to deal with) but also the balance of the 4 quadrants in the detector (not so easy to fix) and a bunch of other factors. Pretty much all microscopy and astrophotography image processing apps have a simple field flattening tool for removing this where a light frame is taken (could be done on an area of resin, the Cu standard, the holder etc) and the gradation removed. I would use this type of tool all the time if available.

knapp-amics commented 2 years ago

@Matt-Power do you have any examples in Python I can share with Robb? Do you think we need to do a BSE standard correction at the center and edge to correct it?

Matt-Power commented 2 years ago

Haven't looked at python as it needs to be done on a frame by frame basis rather than on the final image i.e. would ideally sit within Investigator (as per offset calibration) or Process (as per BSE correction). It's usually done by taking a reference image (a normally exposed image of a uniform surface such as blank area of resin, a polished area of aluminium on the holder, or the Cu standard) and then subtracting the signal variance from each subsequent frame. Here's some general stuff (10s search so sure there is better out there): https://en.wikipedia.org/wiki/Flat-field_correction And here's something similar for ImageJ: https://imagej.net/plugins/bigstitcher/flatfield-correction The ImageJ workflow includes a dark frame too which is good for things like amp glow and hot pixels in digital cameras - not sure you'd need that though. You'd probably need to do the bright frame on a defocused image (or you can apply an extreme blur / softening step) or similar as you don't want scratches, dust, other crud to be included in the flat frame correction.

knapp-amics commented 2 years ago

As we work to improve BSE stability, this is good to implement. What is best is to take the frame-by-frame data and process after data collection but before process. This will help with stitching.

-Bruker Confidential- From: Matt-Power @.> Sent: Monday, April 11, 2022 4:16 PM To: Bruker-Amics/bugs_features @.> Cc: Knapp, Jonathan @.>; Comment @.> Subject: Re: [Bruker-Amics/bugs_features] Flat-Field Correction (#100)

EXTERNAL EMAIL

Haven't looked at python as it needs to be done on a frame by frame basis rather than on the final image i.e. would ideally sit within Investigator (as per offset calibration) or Process (as per BSE correction). It's usually done by taking a reference image (a normally exposed image of a uniform surface such as blank area of resin, a polished area of aluminium on the holder, or the Cu standard) and then subtracting the signal variance from each subsequent frame. Here's some general stuff (10s search so sure there is better out there): https://en.wikipedia.org/wiki/Flat-field_correction And here's something similar for ImageJ: https://imagej.net/plugins/bigstitcher/flatfield-correction The ImageJ workflow includes a dark frame too which is good for things like amp glow and hot pixels in digital cameras - not sure you'd need that though. You'd probably need to do the bright frame on a defocused image (or you can apply an extreme blur / softening step) or similar as you don't want scratches, dust, other crud to be included in the flat frame correction.

- Reply to this email directly, view it on GitHubhttps://github.com/Bruker-Amics/bugs_features/issues/100#issuecomment-1095635921, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUCMQ3DKLMR56VAIBZZAJRDVESQBJANCNFSM5CPQ525Q. You are receiving this because you commented.Message ID: @.**@.>>

jkabel commented 2 years ago

Sorry for the giant images.

One thing the FEI Quanta seems to have going for it is the ability to deliver massive current without a lot of vignetting. I don't think there's any secret sauce here, given the age of the system (2003). I specifically don't suspect anything like an intermediate lens (a la Tescan) that would allow large FOV trickery.

Here's a stitched image of a section loaded with galena (tuned to epoxy-0/gold-250) collected at 20mm with enough counts to saturate out my 30mm detectors, despite them being pointed at the wrong place. The vignetting is quite acceptable. testLongWDStitch-550kcps

Here's an exaggerated contrast image, same conditions, to show the vignetting: testLongWDVignettingHiCon-TooManykcps

Is there any application specific instrument configuration Hitachi could make to alleviate some of the vignetting? Maybe different condenser apertures?

knapp-amics commented 2 years ago

Thanks for this! I will bring it up. A software solution may be good enough. Using proved subtraction combined with reference image collection, we can likely address this in a pre-processing step. It is not out of the question to have an application-specific hardware configuration.

-Bruker Confidential- From: jkabel @.> Sent: Monday, April 11, 2022 4:56 PM To: Bruker-Amics/bugs_features @.> Cc: Knapp, Jonathan @.>; Comment @.> Subject: Re: [Bruker-Amics/bugs_features] Flat-Field Correction (#100)

EXTERNAL EMAIL

Sorry for the giant images.

One thing the FEI Quanta seems to have going for it is the ability to deliver massive current without a lot of vignetting. I don't think there's any secret sauce here, given the age of the system (2003). I specifically don't suspect anything like an intermediate lens (a la Tescan) that would allow large FOV trickery.

Here's a stitched image of a section loaded with galena (tuned to epoxy-0/gold-250) collected at 20mm with enough counts to saturate out my 30mm detectors, despite them being pointed at the wrong place. The vignetting is quite acceptable. https://user-images.githubusercontent.com/12158231/162844839-873a593e-a266-4139-b024-012232d34ef0.png

Here's an exaggerated contrast image, same conditions, to show the vignetting: [testLongWDVignettingHiCon-TooManykcps]https://user-images.githubusercontent.com/12158231/162844848-dfaa874d-03a6-48c2-bef2-ce6b40b78b68.png

Is there any application specific instrument configuration Hitachi could make to alleviate some of the vignetting? Maybe different condenser apertures?

- Reply to this email directly, view it on GitHubhttps://github.com/Bruker-Amics/bugs_features/issues/100#issuecomment-1095669229, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUCMQ3BF5RPVRGFLDJKT4B3VESUX5ANCNFSM5CPQ525Q. You are receiving this because you commented.Message ID: @.**@.>>

knapp-amics commented 2 years ago

@robbmcleod I wanted to bring your attention to this issue.

robbmcleod commented 2 years ago

I'm not very familiar with the S3900, but it looks a bit like a mis-centered objective aperture? It's really not a (symmetrical) vignette, but rather a gradient in intensity, which implies something is mis-centered.

I'm not sure if the S3900 has any alternative objective lenses available or not. I'll ask.

jkabel commented 2 years ago

I suspect something else. He's probably running a damn big aperture and it's hard to get the large ones so off so as to cause a gradient. Maybe the quad balance? I don't know if there are trim pots hiding somewhere. The S3000N didn't have them which was annoying.

@Matt-Power you may want to switch your SBU to square images. It's basically free extra image coverage.

Matt-Power commented 2 years ago

Thanks @jkabel , I'll give the square images a go (not really played with the SBU yet).

We do use a large aperture and the beam and adjustable aperture are aligned before each run so although it's very unlikely to be perfect, it is broadly aligned. The vignetting (which is usually accompanied by image softness / spherical aberration at the edges and in the corners) is more sensitive to alignment but that brightness gradient is always there to some degree so I don't think that it is alignment per se. I've also seen the same sort of gradients with Zeiss, Fei and now Hitachi instruments and it always struck me that a relatively simple / common calibration step would correct it.

We just replaced the BSE detector due to a different issue and I think the new one was balanced with the trim pots but there is still a very slight gradient (always a touch darker at the top). The effect is quite subtle (and no worse than the other platforms) but once you start playing with combined BSE-Mineral steps, it starts to cause a few issues.

knapp-amics commented 2 years ago

Gentlemen, I propose you two meet soon. You are in the same city and would get along famously. I will regret suggesting this, as you will now have an entire coalition in Van... Perhaps we plan a little user group meeting?

-Jonathan

-Bruker Confidential- From: jkabel @.> Sent: Monday, April 11, 2022 6:20 PM To: Bruker-Amics/bugs_features @.> Cc: Knapp, Jonathan @.>; Comment @.> Subject: Re: [Bruker-Amics/bugs_features] Flat-Field Correction (#100)

EXTERNAL EMAIL

I suspect something else. He's probably running a damn big aperture and it's hard to get the large ones so off so as to cause a gradient. Maybe the quad balance? I don't know if there are trim pots hiding somewhere. The S3000N didn't have them which was annoying.

@Matt-Powerhttps://github.com/Matt-Power you may want to switch your SBU to square images. It's basically free extra image coverage.

- Reply to this email directly, view it on GitHubhttps://github.com/Bruker-Amics/bugs_features/issues/100#issuecomment-1095726090, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUCMQ3G62ZDQA4JRF6GHDVTVES6TPANCNFSM5CPQ525Q. You are receiving this because you commented.Message ID: @.**@.>>

knapp-amics commented 2 years ago

All, The University of Adelaide is having issues with the Flat Field. I'd like to revisit this and see if we can make a pre-processing correction in Python that will apply existing off-the-shelf solutions from astrophotography. @Matt-Power and @ChiLyMan shall we have a meeting next week to discuss options?

image

jkabel commented 2 years ago

response_container_BBPPID{font-family: initial; font-size:initial; color: initial;} They may want to try an electron mirror first to see if they dropped a quadrant. That's a lot of vignetting to take out with a correction.-Jacob From: @.: September 28, 2022 9:34 a.m.To: @. to: @.: @.; @.***: Re: [Bruker-Amics/bugs_features] Flat-Field Correction (#100)

All, The University of Adelaide is having issues with the Flat Field. I'd like to revisit this and see if we can make a pre-processing correction in Python that will apply existing off-the-shelf solutions from astrophotography. @Matt-Power and @ChiLyMan shall we have a meeting next week to discuss options?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

Matt-Power commented 2 years ago

Oof, that's pretty nasty. As @jkabel says, this might be too extreme to fix but for milder cases, it should be a reasonably simple process to include a flat field correct in post processing. It will not deal with softening in the corners (i.e. coma etc), just the brightness gradients. @knapp-amics @ChiLyMan - happy to talk next week, just send me a meeting request.

ChiLyMan commented 2 years ago

Have we got the field images? I think I fixed this with ImageJ years back for the NorthWales group.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Matt-Power @.> Sent: Wednesday, September 28, 2022 11:46:39 AM To: Bruker-Amics/bugs_features @.> Cc: Chi Vinh Ly @.>; Mention @.> Subject: Re: [Bruker-Amics/bugs_features] Flat-Field Correction (#100)

Oof, that's pretty nasty. As @jkabelhttps://github.com/jkabel says, this might be too extreme to fix but for milder cases, it should be a reasonably simple process to include a flat field correct in post processing. It will not deal with softening in the corners (i.e. coma etc), just the brightness gradients. @knapp-amicshttps://github.com/knapp-amics @ChiLyManhttps://github.com/ChiLyMan - happy to talk next week, just send me a meeting request.

— Reply to this email directly, view it on GitHubhttps://github.com/Bruker-Amics/bugs_features/issues/100#issuecomment-1261177453, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUFZAAL6BLZLCDG5J4LARXTWARY67ANCNFSM5CPQ525Q. You are receiving this because you were mentioned.Message ID: @.***>