Conversation
…re settings. Implemented compatibility with multichannel labels.
… original augmentor order.
| if len(label.shape) != 3: | ||
| # Single channel label - shouldn't normally happen | ||
| return label | ||
| if len(self.background_label_application) == 0: |
There was a problem hiding this comment.
let's remove background_label_application and just allow apply_background_to_label to accept a list
| if len(transformed_label.shape) == 3: | ||
| transformed_label = self._apply_bkg_to_multichannel_label(transformed_label, probe) | ||
|
|
||
| if self.add_ellipticity or self.add_shift or self.add_scale: |
There was a problem hiding this comment.
shouldn't adding ellipticity/shift/scaling be done before adding background? Otherwise there will be a hard edge to the noise after the shift/scale. You will need to also update the add_bkg function to account for the shifted center (see Zixi's updated augmentor file I sent you a while back for an implementation of that).
There was a problem hiding this comment.
Note that as currently implemented, the apply_bkg method is incorrect if there have been shifts applied. It will be centering the inelastic background on the center of the image, rather than on the shifted center, and this needs to be fixed before merging.
arthurmccray
left a comment
There was a problem hiding this comment.
Overall looks good. Main things are whether the background_label_application flag should exist and the order of when to apply_bkg. Also please attach the updated tutorial notebook to the PR.
|
If I may, would there be a quick and dirty notebook? Love to try this class |
…ion and implemented that functionality in apply_background_to_label, which is now either list or None to reflect this. If None, will not apply, otherwise will apply background to labels according to boolean list. Updated _apply_bkg to incorporate ZiXi's correction for shifts. Changed defaults of gaussian noise to be 0 for mu, 1e-5 for std, and updated docstring to reflect that this scaling is based on total electron dose. Changed application order to be elastic->background. Added aperature related attributes to docstring, and fixed typo in docstring. Added warning if single channel passed to multichannel functions.
|
Heads-up: you'll need to pull dev into the PR to enable the updated automated checks. |
|
@NJMarchese also just a note/reminder to also update the tutorial |
a2d6fc0 to
b9652e1
Compare
|
|
||
| if self.add_bkg: | ||
| result = self._apply_bkg(result, probe) | ||
| if transformed_label is not None and self.apply_background_to_label is not None: |
There was a problem hiding this comment.
Maybe I'm just forgetting, but what is the case where we would want to apply_background_to_label? I can't think of one, and as the logic is broken here, I'm guessing it isn't actually used and should be removed.
| Device for computations ("cpu", "cuda", "cuda:0", etc.). | ||
|
|
||
| add_aperture : bool, default=False | ||
| Enable circular aperture mask to simulate objective aperture effects. |
There was a problem hiding this comment.
this is for simulating a HAADF detector having been inserted
Added an option to apply the background to the labels as well (this was implemented for purpose of adding to the background label image, so amorphous halos + background). The background_label_application is a boolean list (or None) that indicates which label channels to apply the background to if apply_background_to_label is true.
Added gaussian noise, with parameters relative to electron dose.
Implemented ability to work with multichannel labels.
Added preliminary sections for apertures.