Compare commits

..
Author SHA1 Message Date
ohif-bot 22127a8f59 chore(release): publish [skip ci]
- @ohif/viewer@2.3.3
2019-10-30 15:25:05 +00:00
Danny Brown 50ca2bde97 fix: get adapter store picker to show (#1134) 2019-10-30 11:15:51 -04:00
ohif-bot c73cfbc110 chore(release): publish [skip ci]
- @ohif/extension-vtk@0.52.25
 - @ohif/ui@0.58.2
 - @ohif/viewer@2.3.2
2019-10-29 20:47:05 +00:00
Igor Octaviano 5716b71d40 fix: 🐛 Limit image download size to avoid browser issues (#1112)
* fix: 🐛 Limit image download size to avoid browser issues

This fix adjusts the max texture size to allow browser compatibility
(blob size limit)

Closes: #1099

* CR Updates: Clamp values using math.min, remove unnecessary onBlur event and small adjustments
2019-10-29 16:36:34 -04:00
9 changed files with 104 additions and 38 deletions

No files matched your search

+8
View File
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.52.25](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.52.24...@ohif/extension-vtk@0.52.25) (2019-10-29)
**Note:** Version bump only for package @ohif/extension-vtk
## [0.52.24](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.52.23...@ohif/extension-vtk@0.52.24) (2019-10-29)
**Note:** Version bump only for package @ohif/extension-vtk
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-vtk",
"version": "0.52.24",
"version": "0.52.25",
"description": "OHIF extension for VTK.js",
"author": "OHIF",
"license": "MIT",
@@ -53,7 +53,7 @@
},
"devDependencies": {
"@ohif/core": "^1.6.0",
"@ohif/ui": "^0.58.1",
"@ohif/ui": "^0.58.2",
"cornerstone-tools": "^4.0.9",
"cornerstone-wado-image-loader": "^3.0.0",
"dcmjs": "^0.6.1",
+11
View File
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.58.2](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.58.1...@ohif/ui@0.58.2) (2019-10-29)
### Bug Fixes
* 🐛 Limit image download size to avoid browser issues ([#1112](https://github.com/OHIF/Viewers/issues/1112)) ([5716b71](https://github.com/OHIF/Viewers/commit/5716b71d409ee1c6f13393c8cb7f50222415e198)), closes [#1099](https://github.com/OHIF/Viewers/issues/1099)
## [0.58.1](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.58.0...@ohif/ui@0.58.1) (2019-10-29)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/ui",
"version": "0.58.1",
"version": "0.58.2",
"description": "A set of React components for Medical Imaging Viewers",
"author": "OHIF Contributors",
"license": "MIT",
@@ -32,6 +32,7 @@ const DownloadDialog = ({
downloadBlob,
defaultSize,
minimumSize,
maximumSize,
canvasClass,
}) => {
const [filename, setFilename] = useState(DEFAULT_FILENAME);
@@ -75,24 +76,24 @@ const DownloadDialog = ({
}, [defaultSize, disableViewport, enableViewport, viewportElement]);
useEffect(() => {
const validSize = value => (value >= minimumSize ? value : minimumSize);
const loadAndUpdateViewports = async () => {
const {
image,
width: scaledWidth,
height: scaledHeight,
} = await loadImage(activeViewport, viewportElement, width, height);
setLastImage(image);
toggleAnnotations(showAnnotations, viewportElement);
setViewportElementHeight(scaledHeight);
setViewportElementWidth(scaledWidth);
setViewportElementHeight(validSize(scaledHeight));
setViewportElementWidth(validSize(scaledWidth));
setDownloadCanvas(state => ({
...state,
height: scaledHeight,
width: scaledWidth,
height: validSize(scaledHeight),
width: validSize(scaledWidth),
}));
const {
@@ -108,8 +109,8 @@ const DownloadDialog = ({
setViewportPreview(state => ({
...state,
src: dataUrl,
width: viewportElementWidth,
height: viewportElementHeight,
width: validSize(viewportElementWidth),
height: validSize(viewportElementHeight),
}));
};
@@ -125,10 +126,12 @@ const DownloadDialog = ({
updateViewportPreview,
fileType,
downloadCanvas.ref,
minimumSize,
maximumSize,
]);
const onHeightChange = () => {
const newHeight = event.target.value;
const onHeightChange = event => {
const newHeight = Math.min(event.target.value, maximumSize);
setHeight(newHeight);
setViewportElementHeight(newHeight);
@@ -153,7 +156,7 @@ const DownloadDialog = ({
};
const onWidthChange = event => {
const newWidth = event.target.value;
const newWidth = Math.min(event.target.value, maximumSize);
setWidth(newWidth);
setViewportElementWidth(newWidth);
@@ -212,6 +215,7 @@ const DownloadDialog = ({
<TextInput
type="number"
min={minimumSize}
max={maximumSize}
value={width}
label={t('Image width (px)')}
onChange={onWidthChange}
@@ -221,6 +225,7 @@ const DownloadDialog = ({
<TextInput
type="number"
min={minimumSize}
max={maximumSize}
value={height}
label={t('Image height (px)')}
onChange={onHeightChange}
@@ -329,6 +334,7 @@ DownloadDialog.propTypes = {
downloadBlob: PropTypes.func.isRequired,
defaultSize: PropTypes.number.isRequired,
minimumSize: PropTypes.number.isRequired,
maximumSize: PropTypes.number.isRequired,
canvasClass: PropTypes.string.isRequired,
};
+22
View File
@@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.3.3](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.3.2...@ohif/viewer@2.3.3) (2019-10-30)
### Bug Fixes
* get adapter store picker to show ([#1134](https://github.com/OHIF/Viewers/issues/1134)) ([50ca2bd](https://github.com/OHIF/Viewers/commit/50ca2bde971e1e67b73ece96369052dd1a35ac68))
## [2.3.2](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.3.1...@ohif/viewer@2.3.2) (2019-10-29)
### Bug Fixes
* 🐛 Limit image download size to avoid browser issues ([#1112](https://github.com/OHIF/Viewers/issues/1112)) ([5716b71](https://github.com/OHIF/Viewers/commit/5716b71d409ee1c6f13393c8cb7f50222415e198)), closes [#1099](https://github.com/OHIF/Viewers/issues/1099)
## [2.3.1](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.3.0...@ohif/viewer@2.3.1) (2019-10-29)
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/viewer",
"version": "2.3.1",
"version": "2.3.3",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
"license": "MIT",
@@ -50,9 +50,9 @@
"@ohif/extension-dicom-html": "^1.0.1",
"@ohif/extension-dicom-microscopy": "^0.50.6",
"@ohif/extension-dicom-pdf": "^1.0.0",
"@ohif/extension-vtk": "^0.52.24",
"@ohif/extension-vtk": "^0.52.25",
"@ohif/i18n": "^0.51.0",
"@ohif/ui": "^0.58.1",
"@ohif/ui": "^0.58.2",
"@tanem/react-nprogress": "^1.1.25",
"classnames": "^2.2.6",
"core-js": "^3.2.1",
@@ -6,6 +6,7 @@ import cornerstoneTools from 'cornerstone-tools';
const MINIMUM_SIZE = 100;
const DEFAULT_SIZE = 512;
const MAX_TEXTURE_SIZE = 10000;
const mapStateToProps = (state, ownProps) => {
const { viewportSpecificData, activeViewportIndex } = state.viewports;
@@ -14,6 +15,7 @@ const mapStateToProps = (state, ownProps) => {
return {
minimumSize: MINIMUM_SIZE,
maximumSize: MAX_TEXTURE_SIZE,
defaultSize: DEFAULT_SIZE,
canvasClass: 'cornerstone-canvas',
onClose: ownProps.toggleDownloadDialog,
@@ -74,7 +76,6 @@ const mapStateToProps = (state, ownProps) => {
cornerstone.setViewport(viewportElement, viewport);
cornerstone.resize(viewportElement, true);
const MAX_TEXTURE_SIZE = 16384;
const newWidth = Math.min(width || image.width, MAX_TEXTURE_SIZE);
const newHeight = Math.min(
height || image.height,
@@ -108,7 +109,15 @@ const mapStateToProps = (state, ownProps) => {
return window.navigator.msSaveBlob(blob, file);
}
return cornerstoneTools.SaveAs(viewportElement, file, mimetype);
viewportElement.querySelector('canvas').toBlob(blob => {
const URLObj = window.URL || window.webkitURL;
const a = document.createElement('a');
a.href = URLObj.createObjectURL(blob);
a.download = file;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
});
},
};
};
+30 -20
View File
@@ -1,9 +1,9 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useContext } from 'react';
import PropTypes from 'prop-types';
import Dropzone from 'react-dropzone';
import OHIF from '@ohif/core';
import { withRouter } from 'react-router-dom';
import { withTranslation } from 'react-i18next';
import { useTranslation } from 'react-i18next';
import {
StudyList,
PageToolbar,
@@ -26,7 +26,8 @@ import AppContext from '../context/AppContext';
const { urlUtil: UrlUtil } = OHIF.utils;
function StudyListRoute(props) {
const { history, server, t, user, studyListFunctionsEnabled } = props;
const { history, server, user, studyListFunctionsEnabled } = props;
const [t] = useTranslation('Common');
// ~~ STATE
const [sort, setSort] = useState({
fieldName: 'patientName',
@@ -55,6 +56,7 @@ function StudyListRoute(props) {
const [activeModalId, setActiveModalId] = useState(null);
const [rowsPerPage, setRowsPerPage] = useState(25);
const [pageNumber, setPageNumber] = useState(0);
const appContext = useContext(AppContext);
// ~~ RESPONSIVE
const displaySize = useMedia(
['(min-width: 1750px)', '(min-width: 1000px)', '(min-width: 768px)'],
@@ -66,10 +68,10 @@ function StudyListRoute(props) {
const debouncedFilters = useDebounce(filterValues, 250);
// Google Cloud Adapter for DICOM Store Picking
const { appConfig = {} } = AppContext;
const { appConfig = {} } = appContext;
const isGoogleCHAIntegrationEnabled =
!server && appConfig.enableGoogleCloudAdapter;
if (isGoogleCHAIntegrationEnabled) {
if (isGoogleCHAIntegrationEnabled && activeModalId !== 'DicomStorePicker') {
setActiveModalId('DicomStorePicker');
}
@@ -97,8 +99,17 @@ function StudyListRoute(props) {
}
};
fetchStudies();
}, [debouncedFilters, debouncedSort, rowsPerPage, pageNumber, displaySize]);
if (server) {
fetchStudies();
}
}, [
debouncedFilters,
debouncedSort,
rowsPerPage,
pageNumber,
displaySize,
server,
]);
// TODO: Update Server
// if (this.props.server !== prevProps.server) {
@@ -181,6 +192,13 @@ function StudyListRoute(props) {
return (
<>
{studyListFunctionsEnabled ? (
<ConnectedDicomFilesUploader
isOpen={activeModalId === 'DicomFilesUploader'}
onClose={() => setActiveModalId(null)}
/>
) : null}
{healthCareApiWindows}
<WhiteLabellingContext.Consumer>
{whiteLabelling => (
<UserManagerContext.Consumer>
@@ -203,6 +221,7 @@ function StudyListRoute(props) {
</h1>
</div>
<div className="actions">
{studyListFunctionsEnabled && healthCareApiButtons}
{studyListFunctionsEnabled && (
<PageToolbar
onImport={() => setActiveModalId('DicomFilesUploader')}
@@ -232,17 +251,8 @@ function StudyListRoute(props) {
filterValues={filterValues}
onFilterChange={handleFilterChange}
studyListDateFilterNumDays={appConfig.studyListDateFilterNumDays}
>
{studyListFunctionsEnabled ? (
<ConnectedDicomFilesUploader
isOpen={activeModalId === 'DicomFilesUploader'}
onClose={() => setActiveModalId(null)}
/>
) : null}
{healthCareApiButtons}
{healthCareApiWindows}
</StudyList>
}{/* PAGINATION FOOTER */}
/>
{/* PAGINATION FOOTER */}
<TablePagination
currentPage={pageNumber}
nextPageFunc={() => setPageNumber(pageNumber + 1)}
@@ -407,7 +417,7 @@ function _sortStudies(studies, field, order) {
});
// Sort by field
sortedStudies.sort(function (a, b) {
sortedStudies.sort(function(a, b) {
let fieldA = a[field];
let fieldB = b[field];
if (field === 'studyDate') {
@@ -549,4 +559,4 @@ function _getQueryFiltersForValue(filters, fields, value) {
return queryFilters;
}
export default withRouter(withTranslation('Common')(StudyListRoute));
export default withRouter(StudyListRoute);