Skip to content

Possibility to open the failed (not completed) scans#1208

Merged
sergey-yaroslavtsev merged 3 commits intomasterfrom
open_failed_scan
Apr 21, 2026
Merged

Possibility to open the failed (not completed) scans#1208
sergey-yaroslavtsev merged 3 commits intomasterfrom
open_failed_scan

Conversation

@sergey-yaroslavtsev
Copy link
Copy Markdown
Collaborator

@sergey-yaroslavtsev sergey-yaroslavtsev commented Apr 8, 2026

Closes #1175
In the reshape menu a new checkbox was added - to specify that scan is not complete. Then both rows and columns could be set manually (without adjustment to the array size). Array will be pad with nan.

This is a most user-friendly approach from my perspective.

drawbacks:

  1. nan is recognized only in float, while show as 1D stack (not the RGBCorrelator by the way, which do image = numpy.array(image0).astype(numpy.float64)) option was able to keep the original dtype (saving memory sometimes) now if user want to pad, it need to be changed into float anyway. I do not see anything else to be used instead of nan without making confusions or adding issues.
  2. need also to pad info (_padStackInfoArrays in QStackWidget) to be able to use other functionality - not a big deal but could be considered as an ugly solution... for example StackBase McaAdvancedFitBatch use this info and/or positioners including their shape/size. positioners could be pad with nan, other things like time i pad with zeros.

If the checkbox is not ticked the logic should remain as it was before - so new code could break only new feature itself.

image image

padded[:old_length] = flat
self._imageDict[key]["image"] = padded
self.__prePadLength = old_length
self.__imageLength = new_length
Copy link
Copy Markdown
Collaborator

@woutdenolf woutdenolf Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken this function gets called whenever the user changes the number of rows or columns in the pop-up dialog right? Since we replace the images in-place, how can that work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I was not clear. This part is for 'reshape' in RGBCorrelator, when image is open and user click "reshape".

This reshape dialog which was modified appears in two scenarios:

  1. through QStackWidget (on call of ROIImaging tool)
  2. 'reshape' button in RGBCorrelator.

I thought that it is easier to add padding also to RGBCorrelator (do not know if anyone need it) rather then create a new dialog or making it flexible.

If you find it confusing and useless this dialog can be separate to two different and then padding for RGBCorrelator can be removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably it could be useful for similar purpose - if i understood correctly some ROI could be collected as a counter - then it could be crushed/aborted/... flatten 2D image - which to be visualized properly need the padding as well.
Or am i missing the point?

image

Copy link
Copy Markdown
Collaborator

@woutdenolf woutdenolf Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I need lots of time to understand all this.

Is the "reshape" button the the RGB correlator new? What does it do? Same for "Image size" and "300 x 300".

I cannot even open the RGB correlator without any data just the see the widget.

Copy link
Copy Markdown
Collaborator Author

@sergey-yaroslavtsev sergey-yaroslavtsev Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the "reshape" button the the RGB correlator new? What does it do? Same for "Image size" and "300 x 300".

It is not new. It reshape the array to represent it. For example you can open 1D dataset of 25 and the click reshape and make it look 5x5. "image size" just shows you the current status of shape (rows and columns).

like:
image
image
image

I cannot even open the RGB correlator without any data just the see the widget.

It is strange - if you open RGBCorrelator and then close the file chooser, the widget appears with no data:
image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you cannot open ROI tool without data, it is true.

@sergey-yaroslavtsev
Copy link
Copy Markdown
Collaborator Author

  1. All padding in QStackWidget happen in one method.
  2. Specific message explaining that crop is not allowed.

Crop is forbidden to avoid confusion from user side (if they wrongly pad) - so the data could not be "deleted" only "added".
It was shortly discussed. If users will request the crop option as well one need to take into account that data is modified in-place, thus, once data is cropped it could not be restored - either to keep data separately or force reread every time.

msg = qt.QMessageBox(self)
msg.setIcon(qt.QMessageBox.Critical)
msg.setText(
"Shape %d x %d = %d is smaller than data size %d.\n\n"
Copy link
Copy Markdown
Collaborator

@woutdenolf woutdenolf Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for "reshape" in the RGB correlator right? So we need something like this for ROI imaging as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QStackWidget use dialog from RGBCorrelatorWidget. Then this dialog pass shape (entered by user) to the widget.

This message is on dialog side (on accept) - no matter in what widget it happens.
Padding is happening on widget side - we need two padding mechanisms.

Copy link
Copy Markdown
Collaborator Author

@sergey-yaroslavtsev sergey-yaroslavtsev Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've tested it works in both as intended. there was a typo - i fixed it.

update: i mean the error message appears in both case when dialog is called from RGBCorrelator and from ROItool

@sergey-yaroslavtsev sergey-yaroslavtsev merged commit 5aa1536 into master Apr 21, 2026
10 checks passed
@sergey-yaroslavtsev sergey-yaroslavtsev deleted the open_failed_scan branch April 21, 2026 12:44
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.

Possibility to open "failed" scans

2 participants