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

Edit id z stack #518

Merged
merged 6 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/js/models/panel_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
var newData = {'imageId': data.imageId,
'name': data.name,
'sizeZ': data.sizeZ,
'theZ': data.theZ,
'sizeT': data.sizeT,
'orig_width': data.orig_width,
'orig_height': data.orig_height,
Expand All @@ -106,10 +105,13 @@
'deltaT': data.deltaT,
};

// theT is not changed unless we have to...
// theT and theZ are not changed unless we have to...
if (this.get('theT') >= newData.sizeT) {
newData.theT = newData.sizeT - 1;
}
if (this.get('theZ') >= newData.sizeZ) {
newData.theZ = newData.sizeZ - 1;
}

// Make sure dx and dy are not outside the new image
if (Math.abs(this.get('dx')) > newData.orig_width/2) {
Expand Down
27 changes: 25 additions & 2 deletions src/js/views/modal_views.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@
'datasetName': data.meta.datasetName,
'pixel_size_x': data.pixel_size.valueX,
'pixel_size_y': data.pixel_size.valueY,
'pixel_size_z': data.pixel_size.valueZ,
'pixel_size_x_unit': data.pixel_size.unitX,
'pixel_size_z_unit':data.pixel_size.unitZ,
'pixel_size_x_symbol': data.pixel_size.symbolX,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should include pixel_size_z_symbol here too.
If it's missing then the code resorts to using the pixel_size_x_symbol for labels, which is why this works without it, but it would be better to include it.

'pixel_size_z_symbol': data.pixel_size.symbolZ,
'deltaT': data.deltaT,
};
self.newImg = newImg;
Expand Down Expand Up @@ -347,8 +350,8 @@
json.selThumbSrc = WEBGATEWAYINDEX + "render_thumbnail/" + json.selImg.imageId + "/";

// minor attributes ('info' only)
var attrs = ["sizeZ", "orig_width", "orig_height"],
attrName = ['Z size', 'Width', 'Height'];
var attrs = ["orig_width", "orig_height"],
attrName = ['Width', 'Height'];

if (this.newImg) {
json.newImg = this.newImg;
Expand Down Expand Up @@ -380,6 +383,26 @@
} else {
json.comp.sizeT = true;
}

// special message for sizeZ
if (json.selImg.sizeZ != json.newImg.sizeZ) {
// check if any existing images have theZ > new.sizeZ
var tooSmallZ = false;
sel.forEach(function(o){
if (o.get('theZ') > json.newImg.sizeZ) tooSmallZ = true;
});
if (tooSmallZ) {
json.messages.push({"text": "New Image has fewer Z slices than needed. Check after update.",
"status": "danger"});
} else {
json.messages.push({"text":"Mismatch of Z slices: should be OK.",
"status": "success"});
}
json.comp.sizeZ = false;
} else {
json.comp.sizeZ = true;
}

// compare channels
json.comp.channels = json.ok(true);
var selC = json.selImg.channels,
Expand Down