Added capture buttons to navigate pane
This commit is contained in:
parent
e3265b1dff
commit
7c662b2787
1 changed files with 57 additions and 38 deletions
|
|
@ -143,7 +143,7 @@
|
||||||
v-if="fastAutofocusUri"
|
v-if="fastAutofocusUri"
|
||||||
:submit-url="fastAutofocusUri"
|
:submit-url="fastAutofocusUri"
|
||||||
:submit-data="{ dz: 2000 }"
|
:submit-data="{ dz: 2000 }"
|
||||||
:submit-label="'Fast'"
|
:submit-label="'Autofocus'"
|
||||||
:button-primary="false"
|
:button-primary="false"
|
||||||
:submit-on-event="'globalFastAutofocusEvent'"
|
:submit-on-event="'globalFastAutofocusEvent'"
|
||||||
@taskStarted="isAutofocusing = 1"
|
@taskStarted="isAutofocusing = 1"
|
||||||
|
|
@ -151,32 +151,34 @@
|
||||||
@error="modalError"
|
@error="modalError"
|
||||||
></taskSubmitter>
|
></taskSubmitter>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li v-show="captureUri" class="uk-open">
|
||||||
|
<a class="uk-accordion-title" href="#">Image Capture</a>
|
||||||
|
<div class="uk-accordion-content">
|
||||||
|
<div class="uk-grid-small uk-child-width-expand" uk-grid>
|
||||||
|
<taskSubmitter
|
||||||
|
v-if="captureUri"
|
||||||
|
:submit-url="captureUri"
|
||||||
|
:submit-data="{ resolution: 'main' }"
|
||||||
|
:submit-label="'Low Resolution'"
|
||||||
|
:submit-on-event="'globalCaptureEvent'"
|
||||||
|
@response="handleCaptureResponse"
|
||||||
|
@error="modalError"
|
||||||
|
></taskSubmitter>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-show="!isAutofocusing || isAutofocusing == 2">
|
<div class="uk-grid-small uk-child-width-expand" uk-grid>
|
||||||
<taskSubmitter
|
<taskSubmitter
|
||||||
v-if="normalAutofocusUri"
|
v-if="captureUri"
|
||||||
:submit-url="normalAutofocusUri"
|
:submit-url="captureUri"
|
||||||
:submit-data="{ dz: [-90, -60, -30, 0, 30, 60, 90] }"
|
:submit-data="{ resolution: 'full' }"
|
||||||
:submit-label="'Medium'"
|
submit-label="Full Resolution"
|
||||||
:button-primary="false"
|
submit-on-event="globalCaptureEvent"
|
||||||
@taskStarted="isAutofocusing = 2"
|
@response="handleCaptureResponse"
|
||||||
@finished="isAutofocusing = 0"
|
@error="modalError"
|
||||||
@error="modalError"
|
></taskSubmitter>
|
||||||
></taskSubmitter>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-show="!isAutofocusing || isAutofocusing == 3">
|
|
||||||
<taskSubmitter
|
|
||||||
v-if="normalAutofocusUri"
|
|
||||||
:submit-url="normalAutofocusUri"
|
|
||||||
:submit-data="{ dz: [-30, -20, -10, 0, 10, 20, 30] }"
|
|
||||||
:submit-label="'Fine'"
|
|
||||||
:button-primary="false"
|
|
||||||
@taskStarted="isAutofocusing = 3"
|
|
||||||
@finished="isAutofocusing = 0"
|
|
||||||
@error="modalError"
|
|
||||||
></taskSubmitter>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -220,10 +222,7 @@ export default {
|
||||||
},
|
},
|
||||||
setPosition: null,
|
setPosition: null,
|
||||||
isAutofocusing: 0,
|
isAutofocusing: 0,
|
||||||
moveLock: false,
|
moveLock: false
|
||||||
fastAutofocusUri: null,
|
|
||||||
normalAutofocusUri: null,
|
|
||||||
moveInImageCoordinatesUri: null
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -239,6 +238,18 @@ export default {
|
||||||
},
|
},
|
||||||
positionStatusUri: function() {
|
positionStatusUri: function() {
|
||||||
return `${this.baseUri}/stage/position`;
|
return `${this.baseUri}/stage/position`;
|
||||||
|
},
|
||||||
|
fastAutofocusUri: function() {
|
||||||
|
return this.thingActionUrl("autofocus", "fast_autofocus");
|
||||||
|
},
|
||||||
|
captureUri: function() {
|
||||||
|
return this.thingActionUrl("camera", "capture_jpeg");
|
||||||
|
},
|
||||||
|
moveInImageCoordinatesUri: function() {
|
||||||
|
return this.thingActionUrl(
|
||||||
|
"camera_stage_mapping",
|
||||||
|
"move_in_image_coordinates"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -282,8 +293,6 @@ export default {
|
||||||
// Update the current position in text boxes
|
// Update the current position in text boxes
|
||||||
this.updatePosition();
|
this.updatePosition();
|
||||||
// Look for autofocus plugin
|
// Look for autofocus plugin
|
||||||
this.updateAutofocusUri();
|
|
||||||
this.updateMoveInImageCoordinatesUri();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
@ -381,12 +390,22 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateAutofocusUri: function() {
|
handleCaptureResponse: async function(response) {
|
||||||
this.fastAutofocusUri = `${this.baseUri}/autofocus/fast_autofocus`;
|
// Retrieve the captured image and save it
|
||||||
},
|
let imageUri = response.output.href;
|
||||||
|
if (!imageUri) {
|
||||||
updateMoveInImageCoordinatesUri: function() {
|
this.modalError("No image URI returned from capture task.");
|
||||||
this.moveInImageCoordinatesUri = `${this.baseUri}/camera_stage_mapping/move_in_image_coordinates`;
|
console.log(`Capture resulted in response ${response}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// To save the returned data, we make a virtual link and click it
|
||||||
|
let imageResponse = await axios.get(imageUri, { responseType: "blob" });
|
||||||
|
const url = window.URL.createObjectURL(new Blob([imageResponse.data]));
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute("download", `OFM_${new Date().toISOString()}.jpeg`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue