2511-eiger-mask #2

Merged
leonarski_f merged 69 commits from 2511-eiger-mask into main 2025-11-09 12:42:28 +01:00
4 changed files with 28 additions and 20 deletions
Showing only changes of commit f48eb44f2a - Show all commits

View File

@@ -342,6 +342,7 @@ void JFJochDiffractionImage::loadImage(std::shared_ptr<const JFJochReaderImage>
}
image = in_image;
LoadImageInternal();
GeneratePixmap();
Redraw();
} else {
image.reset();
@@ -364,37 +365,37 @@ void JFJochDiffractionImage::setAutoForeground(bool input) {
void JFJochDiffractionImage::setResolutionRing(QVector<float> v) {
res_ring = v;
res_ring_auto = false;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::setResolutionRingAuto() {
res_ring_auto = true;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::showSpots(bool input) {
show_spots = input;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::showPredictions(bool input) {
show_predictions = input;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::setSpotColor(QColor input) {
spot_color = input;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::setPredictionColor(QColor input) {
prediction_color = input;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::showHighestPixels(int32_t v) {
show_highest_pixels = v;
Redraw();
updateOverlay();
}
void JFJochDiffractionImage::DrawSaturation() {
@@ -418,10 +419,11 @@ void JFJochDiffractionImage::DrawCross(float x, float y, float size, float width
void JFJochDiffractionImage::showSaturation(bool input) {
show_saturation = input;
Redraw();
GeneratePixmap();
updateOverlay();
}
void JFJochDiffractionImage::highlightIceRings(bool input) {
highlight_ice_rings = input;
Redraw();
updateOverlay();
}

View File

@@ -30,17 +30,22 @@ void JFJochImage::onScroll(int value) {
void JFJochImage::changeBackground(float val) {
background = val;
GeneratePixmap();
Redraw();
}
void JFJochImage::changeForeground(float val) {
foreground = val;
// Regenerate the image
GeneratePixmap();
Redraw();
}
void JFJochImage::setColorMap(int color_map) {
try {
color_scale.Select(static_cast<ColorScaleEnum>(color_map));
// Regenerate the image
GeneratePixmap();
Redraw();
} catch (...) {
}
@@ -48,6 +53,7 @@ void JFJochImage::setColorMap(int color_map) {
void JFJochImage::setFeatureColor(QColor input) {
feature_color = input;
GeneratePixmap();
Redraw();
}
@@ -65,6 +71,8 @@ void JFJochImage::wheelEvent(QWheelEvent *event) {
new_foreground = 1.0;
foreground = new_foreground;
emit foregroundChanged(foreground);
GeneratePixmap();
Redraw();
} else {
// Perform zooming
@@ -438,15 +446,19 @@ void JFJochImage::Redraw() {
// Save the current transformation (zoom state)
QTransform currentTransform = this->transform();
// Regenerate the image
DrawImage();
QGraphicsScene *currentScene = scene();
if (!currentScene) {
// First time - create a new scene
currentScene = new QGraphicsScene(this);
setScene(currentScene);
}
// Restore the zoom level
this->setTransform(currentTransform, false); // "false" prevents resetting the view
updateOverlay();
}
void JFJochImage::DrawImage() {
void JFJochImage::GeneratePixmap() {
/*
if (auto_fg || auto_bg) {
@@ -498,13 +510,6 @@ void JFJochImage::DrawImage() {
}
pixmap = QPixmap::fromImage(qimg);
QGraphicsScene *currentScene = scene();
if (!currentScene) {
// First time - create a new scene
currentScene = new QGraphicsScene(this);
setScene(currentScene);
}
}
void JFJochImage::centerOnSpot(QPointF point) {

View File

@@ -22,7 +22,7 @@ class JFJochImage : public QGraphicsView {
protected:
virtual void mouseHover(QMouseEvent* event) = 0;
void DrawROI();
void DrawImage();
void GeneratePixmap();
void Redraw();
bool show_saturation = false;

View File

@@ -24,6 +24,7 @@ void JFJochSimpleImage::setImage(std::shared_ptr<const SimpleImage> img) {
if (img) {
image_ = std::move(img);
loadImageInternal();
GeneratePixmap();
Redraw();
} else {
image_.reset();