Skip to content

Commit d86267f

Browse files
committed
Fix coding style issues
1 parent 3300df7 commit d86267f

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

src/channel.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { VLWholeSlideMicroscopyImage, getFrameMapping } from './metadata.js'
22
import *
3-
as DICOMwebClient from 'dicomweb-client'
3+
as DICOMwebClient from 'dicomweb-client'
44
import {
55
areNumbersAlmostEqual,
66
are1DArraysAlmostEqual,
@@ -272,7 +272,7 @@ class _Channel {
272272
const {
273273
thresholdValues,
274274
limitValues,
275-
color,
275+
color
276276
} = this.blendingInformation
277277

278278
const frameData = {
@@ -283,7 +283,7 @@ class _Channel {
283283
thresholdValues,
284284
limitValues,
285285
color,
286-
opacity : 1, // the opacity is actually handled at OpenLayer level
286+
opacity: 1, // handled by OpenLayers
287287
columns,
288288
rows
289289
}
@@ -334,7 +334,7 @@ class _Channel {
334334
const {
335335
thresholdValues,
336336
limitValues,
337-
color,
337+
color
338338
} = this.blendingInformation
339339

340340
const frameData = {
@@ -345,7 +345,7 @@ class _Channel {
345345
thresholdValues,
346346
limitValues,
347347
color,
348-
opacity : 1, // the opacity is actually handled at OpenLayer level
348+
opacity: 1, // handled by OpenLayers
349349
columns,
350350
rows
351351
}
@@ -364,7 +364,10 @@ class _Channel {
364364
sopInstanceUID,
365365
frameNumbers,
366366
mediaTypes: [
367-
{ mediaType: octetStreamMediaType, transferSyntaxUID: octetStreamTransferSyntaxUID }
367+
{
368+
mediaType: octetStreamMediaType,
369+
transferSyntaxUID: octetStreamTransferSyntaxUID
370+
}
368371
]
369372
}
370373
options.client.retrieveInstanceFrames(retrieveOptions).then(
@@ -373,7 +376,7 @@ class _Channel {
373376
const {
374377
thresholdValues,
375378
limitValues,
376-
color,
379+
color
377380
} = this.blendingInformation
378381

379382
const frameData = {
@@ -384,7 +387,7 @@ class _Channel {
384387
thresholdValues,
385388
limitValues,
386389
color,
387-
opacity : 1, // the opacity is actually handled at OpenLayer level
390+
opacity: 1, // handled by OpenLayers
388391
columns,
389392
rows
390393
}
@@ -408,7 +411,7 @@ class _Channel {
408411
* NOTE: transition = 0 disable OpenLayer transition alpha opacity
409412
* NOTE: it is needed a very large initial cacheSize value
410413
* otherwise, the tile caches will be cleared at each zoom
411-
* providing very bad perfomances.
414+
* providing very bad perfomances.
412415
*/
413416
this.rasterSource = new TileImage({
414417
crossOrigin: 'Anonymous',
@@ -458,24 +461,24 @@ class _Channel {
458461
})
459462

460463
if (image.microscopyImages.length === 0) {
461-
throw new Error('No VOLUME image provided for Optioncal Path ID: ' +
464+
throw new Error('No VOLUME image provided for Optioncal Path ID: ' +
462465
image.blendingInformation.opticalPathIdentifier)
463466
}
464467

465468
image.FrameOfReferenceUID = image.microscopyImages[0].FrameOfReferenceUID
466469
for (let i = 0; i < image.microscopyImages.length; ++i) {
467470
if (image.FrameOfReferenceUID !== image.microscopyImages[i].FrameOfReferenceUID) {
468-
throw new Error('Optioncal Path ID ' +
469-
image.blendingInformation.opticalPathIdentifier +
471+
throw new Error('Optioncal Path ID ' +
472+
image.blendingInformation.opticalPathIdentifier +
470473
' has volume microscopy images with different FrameOfReferenceUID')
471474
}
472475
}
473476

474477
image.ContainerIdentifier = image.microscopyImages[0].ContainerIdentifier
475478
for (let i = 0; i < image.microscopyImages.length; ++i) {
476479
if (image.ContainerIdentifier !== image.microscopyImages[i].ContainerIdentifier) {
477-
throw new Error('Optioncal Path ID ' +
478-
image.blendingInformation.opticalPathIdentifier +
480+
throw new Error('Optioncal Path ID ' +
481+
image.blendingInformation.opticalPathIdentifier +
479482
' has volume microscopy images with different ContainerIdentifier')
480483
}
481484
}
@@ -741,7 +744,7 @@ class _Channel {
741744
thresholdValues,
742745
limitValues,
743746
color,
744-
opacity : 1, // the opacity is actually handled at OpenLayer level
747+
opacity: 1, // handled by OpenLayers
745748
columns,
746749
rows
747750
}

src/metadata.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ function formatMetadata (metadata) {
116116
/** Struct DICOM metadata of monochrome slides in groups by OpticalPathIdentifier.
117117
*
118118
* @param {Object[]} metadata
119-
*
119+
*
120120
* @returns {Object[]} groups of VLWholeSlideMicroscopyImages
121121
* @memberof metadata
122122
*/
123-
function groupMonochromeInstances(metadataArray) {
123+
function groupMonochromeInstances (metadataArray) {
124124
const channels = []
125125
for (let i = 0; i < metadataArray.length; ++i) {
126126
const microscopyImage = new VLWholeSlideMicroscopyImage({ metadata: metadataArray[i] })
@@ -135,7 +135,7 @@ function groupMonochromeInstances(metadataArray) {
135135
const channel = channels.find(channel => {
136136
return channel[0].OpticalPathSequence[0].OpticalPathIdentifier === pathIdentifier
137137
})
138-
138+
139139
if (channel) {
140140
channel.push(microscopyImage)
141141
} else {
@@ -150,11 +150,11 @@ function groupMonochromeInstances(metadataArray) {
150150
/** Struct DICOM metadata of colored slides in groups by OpticalPathIdentifier.
151151
*
152152
* @param {Object[]} metadata
153-
*
153+
*
154154
* @returns {Object[]} groups of VLWholeSlideMicroscopyImages
155155
* @memberof metadata
156156
*/
157-
function groupColorInstances(metadataArray) {
157+
function groupColorInstances (metadataArray) {
158158
const colorImages = []
159159
for (let i = 0; i < metadataArray.length; ++i) {
160160
const microscopyImage = new VLWholeSlideMicroscopyImage({ metadata: metadataArray[i] })
@@ -165,12 +165,12 @@ function groupMonochromeInstances(metadataArray) {
165165
if (microscopyImage.SamplesPerPixel !== 1 &&
166166
(microscopyImage.PhotometricInterpretation === 'RGB' ||
167167
microscopyImage.PhotometricInterpretation.includes('YBR'))) {
168-
//this is a color channel
168+
// this is a color channel
169169
const pathIdentifier = microscopyImage.OpticalPathSequence[0].OpticalPathIdentifier
170170
const colorImage = colorImages.find(colorImage => {
171171
return colorImage[0].OpticalPathSequence[0].OpticalPathIdentifier === pathIdentifier
172172
})
173-
173+
174174
if (colorImage) {
175175
colorImage.push(microscopyImage)
176176
} else {
@@ -182,7 +182,6 @@ function groupMonochromeInstances(metadataArray) {
182182
return colorImages
183183
}
184184

185-
186185
/** DICOM VL Whole Slide Microscopy Image instance
187186
* (without Pixel Data or any other bulk data).
188187
*

src/viewer.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ class VolumeImageViewer {
588588
limitValues,
589589
visible
590590
})
591-
591+
592592
const newChannel = new _Channel(defaultBlendingInformation)
593593
newChannel.addMetadata(channelMicroscopyImage.originMetadata)
594594
this[_channels].push(newChannel)
@@ -1005,7 +1005,7 @@ class VolumeImageViewer {
10051005
const frameNumbers = DICOMwebClient.utils.getFrameNumbersFromUri(src)
10061006

10071007
console.info(`retrieve frames ${frameNumbers}`)
1008-
1008+
10091009
if (this[_options].retrieveRendered) {
10101010
// allowed mediaTypes: http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_8.7.4.html
10111011
const pngMediaType = 'image/png'
@@ -1120,7 +1120,7 @@ class VolumeImageViewer {
11201120
* NOTE: transition = 0 disable OpenLayer transition alpha opacity
11211121
* NOTE: it is needed a very large initial cacheSize value
11221122
* otherwise, the tile caches will be cleared at each zoom
1123-
* providing very bad perfomances.
1123+
* providing very bad perfomances.
11241124
*/
11251125
this[_colorImage].rasterSource = new TileImage({
11261126
crossOrigin: 'Anonymous',
@@ -1150,15 +1150,15 @@ class VolumeImageViewer {
11501150
if (this[_channels].length === 0 && this[_colorImage] === undefined) {
11511151
throw new Error('No channels or colorImage found.')
11521152
}
1153-
1154-
let channel = undefined
1153+
1154+
let channel
11551155
if (this[_channels].length !== 0) {
11561156
channel = this[_channels].find(
11571157
channel => channel.blendingInformation.opticalPathIdentifier === opticalPathIdentifier
11581158
)
11591159
}
1160-
1161-
let colorImage = undefined
1160+
1161+
let colorImage
11621162
if (this[_colorImage] !== undefined) {
11631163
colorImage = this[_colorImage].opticalPathIdentifier === opticalPathIdentifier
11641164
? this[_colorImage]
@@ -1291,8 +1291,8 @@ class VolumeImageViewer {
12911291
* @param {string} opticalPathIdentifier - opticalPath of the channel
12921292
* @return {boolean} active
12931293
*/
1294-
isOpticalPathActive (opticalPathIdentifier) {
1295-
const channel = this.getOpticalPath(opticalPathIdentifier)
1294+
isOpticalPathActive (opticalPathIdentifier) {
1295+
const channel = this.getOpticalPath(opticalPathIdentifier)
12961296
if (channel === null) {
12971297
return false
12981298
}

0 commit comments

Comments
 (0)