Skip to content

Commit

Permalink
Enabled downloading of full sized image
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronge-2020 committed Feb 8, 2024
1 parent f2142fa commit a07dac8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
17 changes: 15 additions & 2 deletions drawCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -1734,9 +1734,22 @@ async function createImageForCore(svsImageURL, core, coreSize = 64) {
const fileName = `core_${core.row + 1}_${core.col + 1}.jpg`; // Construct file name

// Function to initiate download
const initiateDownload = (blobUrl, fileName) => {
const initiateDownload = async (blobUrl, fileName) => {
const downloadLink = document.createElement('a');
downloadLink.href = blobUrl;

// Use the getRegionFromWSI function to download the full resolution version of the image
const fullResTileParams = {
tileX: core.x - core.currentRadius,
tileY: core.y - core.currentRadius,
tileWidth: coreWidth,
tileHeight: coreHeight,
tileSize: coreWidth,
};

const fullSizeImageResp = await getRegionFromWSI(svsImageURL, fullResTileParams);
const blob = await fullSizeImageResp.blob();

downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = fileName;
document.body.appendChild(downloadLink);
downloadLink.click();
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,12 @@ <h2>Virtual Grid Configuration</h2>
<output id="verticalSpacingValue" for="verticalSpacing">50</output>

<label for="startingX">Starting X:</label>
<input type="range" id="startingX" name="startingX" min="1" max="200" value="50">
<output id="startingXValue" for="startingX">50</output>
<input type="range" id="startingX" name="startingX" min="0" max="200" value="0">
<output id="startingXValue" for="startingX">0</output>

<label for="startingY">Starting Y:</label>
<input type="range" id="startingY" name="startingY" min="1" max="200" value="50">
<output id="startingYValue" for="startingY">50</output>
<input type="range" id="startingY" name="startingY" min="0" max="200" value="0">
<output id="startingYValue" for="startingY">0</output>

</fieldset>
<button type="button" id="applyVirtualGridSettings">Apply Grid Settings</button>
Expand Down

0 comments on commit a07dac8

Please sign in to comment.