Skip to content

Commit

Permalink
Fix selection of VOLUME images (ImagingDataCommons#83)
Browse files Browse the repository at this point in the history
* Fix selection of volume images
* Upgrade package dependencies
* Update package version
  • Loading branch information
hackermd authored Jan 31, 2022
1 parent bb7327e commit ddbc7d2
Show file tree
Hide file tree
Showing 3 changed files with 1,222 additions and 1,383 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slim",
"version": "0.4.4",
"version": "0.4.5",
"homepage": "https://github.com/mghcomputationalpathology/slim",
"private": true,
"dependencies": {
Expand Down
26 changes: 8 additions & 18 deletions src/data/slides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,14 @@ class Slide {
}
})
if (volumeImages.length === 0) {
throw new Error(
'At least one volume image must be provided for a slide.'
)
throw new Error('At least one volume image must be provided for a slide.')
} else {
const photometricInterpretations = new Set([] as string[])
volumeImages.forEach((image) => {
photometricInterpretations.add(image.PhotometricInterpretation)
})
if (photometricInterpretations.size > 1) {
const samplesPerPixel = new Set([] as number[])
volumeImages.forEach(image => samplesPerPixel.add(image.SamplesPerPixel))
if (samplesPerPixel.size > 1) {
throw new Error(
'All volume images of a slide must have the same ' +
'Photometric Interpretation.'
'All volume images of a slide must have the same number of ' +
'Samples per Pixel.'
)
}
}
Expand Down Expand Up @@ -162,16 +158,10 @@ const createSlides = (
if (volumeImages.length > 0) {
const refImage = volumeImages[0]
const filteredVolumeImages = volumeImages.filter((image) => {
return (
refImage.SamplesPerPixel === image.SamplesPerPixel &&
refImage.PhotometricInterpretation === image.PhotometricInterpretation
)
return refImage.SamplesPerPixel === image.SamplesPerPixel
})
const filteredOverviewImages = overviewImages.filter((image) => {
return (
refImage.SamplesPerPixel === image.SamplesPerPixel &&
refImage.PhotometricInterpretation === image.PhotometricInterpretation
)
return refImage.SamplesPerPixel === image.SamplesPerPixel
})
const slideMetadataIndex = slideMetadata.findIndex((slide) => {
return _doesImageBelongToSlide(slide, refImage)
Expand Down
Loading

0 comments on commit ddbc7d2

Please sign in to comment.