tests/image
Source: geometry.test.js:20
Instance Methods
annotationConstructor()
Tests for Annotation constructor defaults.
annotationUniqueIds()
Tests that each Annotation instance receives unique ids.
annotationMetaAddGet()
Tests for Annotation meta data add/get/list operations.
annotationMetaOverwrite()
Tests that Annotation#addMetaItem warns when overwriting.
annotationMetaRemove()
Tests for Annotation#removeMetaItem.
annotationCanView()
Tests for Annotation#canView initial state.
annotationGetTextPlain()
Tests for Annotation#getText with no quantification.
annotationGetTextFlags()
Tests for Annotation#getText with flag substitution.
annotationGetTextEmpty()
Tests for Annotation#getText with empty textExpr.
annotationCompatibleViewNoPlane()
Tests for Annotation#isCompatibleView without planePoints.
annotationCompatibleViewPlane()
Tests for Annotation#isCompatibleView with planePoints set.
annotationOrientationUndefined()
Tests for Annotation#getOrientationName without planePoints.
annotationOrientationAxial()
Tests for Annotation#getOrientationName with axial planePoints.
annotationInit()
Tests for Annotation#init setting annotation fields.
annotationInitFrameNumber()
Tests that Annotation#init sets a 1-based frame number from the position time index.
annotationCentroidVolumeId()
Tests that Annotation#getCentroid uses the volume id of the referenced frame.
annotationInitTwice()
Tests that a second Annotation#init call is a no-op.
annotationInitOriented()
Tests that init stores planePoints for non-acquisition orientation.
annotationSetVcUnknownUid()
Tests that Annotation#setViewController warns on unknown UID.
annotationSetVcIncompatible()
Tests that Annotation#setViewController is rejected for incompatible views.
annotationSetVcCompatible()
Tests that Annotation#setViewController succeeds for a compatible view.
annotationSetVcLegacyCosines()
Tests that Annotation#setViewController replaces legacy plane cosines.
annotationSetTextNoVc()
Tests for Annotation#setTextExpr without a view controller.
annotationSetTextModality()
Tests for Annotation#setTextExpr using modality-specific text.
annotationSetTextFallback()
Tests for Annotation#setTextExpr falling back to '*'.
annotationGetFactoryNoShape()
Tests for Annotation#getFactory when no mathShape is set.
annotationGetFactoryNoMatch()
Tests for Annotation#getFactory when no factory supports the given shape.
annotationGroupEventNames()
Tests that annotationGroupEventNames exports the expected events.
annotationGroupCtorEmpty()
Tests for AnnotationGroup constructor with no arguments.
annotationGroupCtorList()
Tests for AnnotationGroup constructor with an initial list.
annotationGroupEditable()
Tests for AnnotationGroup#setEditable toggling and event firing.
annotationGroupColour()
Tests for AnnotationGroup#setColour / getColour.
annotationGroupAdd()
Tests for AnnotationGroup#add updating the list and firing events.
annotationGroupAddPropagate()
Tests that AnnotationGroup#add forwards the propagate flag.
annotationGroupFind()
Tests for AnnotationGroup#find by tracking UID.
annotationGroupUpdate()
Tests for AnnotationGroup#update replacing the entry and firing annotationupdate.
annotationGroupUpdateQuantification()
Tests that update calls updateQuantification when mathShape changes.
annotationGroupUpdateTextExpr()
Tests that update calls updateQuantification when textExpr changes.
annotationGroupUpdateNoQuantification()
Tests that update does NOT call updateQuantification for unrelated keys.
annotationGroupUpdateNotFound()
Tests that update warns when the annotation is not found.
annotationGroupRemove()
Tests for AnnotationGroup#remove by UID.
annotationGroupRemoveNotFound()
Tests that remove warns when the annotation is not found.
annotationGroupRemoveSelective()
Tests that remove only removes the targeted annotation, preserving others.
annotationGroupSetViewController()
Tests that AnnotationGroup#setViewController delegates to each annotation and triggers quantification updates.
annotationGroupMeta()
Tests for AnnotationGroup meta data CRUD.
annotationGroupRemoveListener()
Tests for AnnotationGroup#removeEventListener.
decoderConstructor()
Tests for PixelBufferDecoder constructor.
decoderDefaultHandlers()
Tests that all default event handlers are no-ops.
decoderCallbackWiring()
Tests that the first decode() call wires the decoder's event handlers onto the pool.
decoderCallbackWiringOnce()
Tests that pool callbacks are assigned only once across multiple decode calls.
decoderRouteJpegBaseline()
Tests that decode() routes 'jpeg-baseline' to the correct worker task.
decoderRouteJpegLossless()
Tests that decode() routes 'jpeg-lossless' to the correct worker task.
decoderRouteJpeg2000()
Tests that decode() routes 'jpeg2000' to the correct worker task.
decoderRouteRle()
Tests that decode() routes 'rle' to the correct worker task.
decoderTaskPayload()
Tests that the worker task receives the correct buffer, meta and info.
decoderTaskStartMessage()
Tests that the decoder task start message holds a compact copy of the input buffer and transfers it.
decoderUnknownAlgo()
Tests that decode() does not add a task for an unrecognised algorithm.
decoderAbort()
Tests that abort() delegates to the underlying thread pool.
domReaderImageSource()
Tests that getViewFromDOMImage returns data and preserves origin as source.
domReaderImageUrlInfo()
Tests that meta info fields are populated correctly for a URL origin.
domReaderImageFileInfo()
Tests that meta info fields are populated correctly for a File origin.
domReaderImageDefaultIndex()
Tests that index defaults to 0 when not supplied.
domReaderImagePhotometric()
Tests that the created image has RGB photometric interpretation.
domReaderImageStripAlpha()
Tests that alpha is stripped: the image buffer holds only RGB bytes.
domReaderImageSeriesUid()
Tests that SeriesInstanceUID is set in the image meta.
domReaderVideoLoaditemUrl()
Tests that onloaditem fires on the first seeked event (URL origin).
domReaderVideoLoaditemFile()
Tests that onloaditem fires on the first seeked event (File origin).
domReaderVideoProgress()
Tests that onprogress fires for every frame.
domReaderVideoLoadEnd()
Tests that onload and onloadend fire after the last frame.
domReaderVideoMultiframe()
Tests multi-frame: appendFrameBuffer called and listener removed at end.
thresholdFilterName()
Tests for ThresholdFilter getName.
thresholdFilterAccessors()
Tests for ThresholdFilter min/max accessors.
thresholdFilterImageAccessor()
Tests for ThresholdFilter image accessor.
thresholdFilterNewImage()
Tests that update returns a new image, leaving the original unchanged.
thresholdFilterInsideRange()
Tests that values inside [min, max] are preserved.
thresholdFilterOutsideRange()
Tests that values outside [min, max] are replaced with imageMin.
sharpenFilterName()
Tests for SharpenFilter getName.
sharpenFilterImageAccessor()
Tests for SharpenFilter image accessor.
sharpenFilterNewImage()
Tests that update returns a new image.
sharpenFilterUniform()
Tests that a uniform image is preserved by the sharpen kernel. For a flat region: 5v - 4v = v at every interior pixel.
sharpenFilterCenterPixel()
Tests the sharpen kernel coefficient at the centre pixel. With all neighbours = 0 and centre = 100, the centre output = 5 × 100.
sobelFilterName()
Tests for SobelFilter getName.
sobelFilterImageAccessor()
Tests for SobelFilter image accessor.
sobelFilterNewImage()
Tests that update returns a new image.
sobelFilterUniform()
Tests that a uniform image produces zero gradient everywhere. GradX = gradY = 0 on a flat field → sqrt(0² + 0²) = 0.
sobelFilterStepEdge()
Tests that the Sobel output is floor(sqrt(gradX² + gradY²)). A vertical step edge gives a known horizontal gradient.
geometryClass()
Tests for Geometry.
geometryIsSimilar()
Tests for Geometry#isSimilar.
geometryWorldToIndexIrregularSpacing()
Test that Geometry#worldToIndex resolves the correct slice for an irregularly spaced grid, instead of naively extrapolating from origin #0 with a single rounded spacing value (which gives an out-of-range index for this data).
geometryWorldToIndexOutOfRange()
Test that Geometry#worldToIndex falls back to the naive arithmetic result (and so stays correctly out of range) for a position that isn't actually close to any real origin, instead of spuriously snapping to whichever origin happens to be closest.
geometryWorldToIndexGantryTilt()
Regression test for a real gantry-tilted CT geometry (tilted ImageOrientationPatient, so consecutive origins shift in Y as well as Z): Geometry#worldToIndex and Geometry#getSliceIndex must both resolve every real slice's own position back to its own index - including for points away from the slice corner (eg. A click anywhere else in the image), since the in-plane offset must not leak into the slice decision. The naive uniform-grid formula worldToIndex used to fall back on gets this systematically wrong for this data (verified separately: it returned [0,0,-1]..[0,0,-11] for slices 1..10, not merely off-by-one)..
geometryWorldToIndexNoBoundaryDuplicate()
Regression test for a real DICOM SEG-on-reference-series scenario (mask geometry covers only a few slices out of a larger, tilted reference series): Geometry#worldToIndex must not duplicate the mask's last real slice onto the reference slice just past it. The queried position isn't a stored origin, it's reconstructed via the reference geometry's own indexToWorld (origin + spacing*index), same as App/ViewController do when syncing a scroll position across layers of different geometries - that reconstruction carries a few 1e-6 mm of float drift for a tilted (multi-matrix-multiply) orientation, which used to land just under the exact slice boundary and get floored down one slice too far, right back into the mask's valid range.
geometryGetSliceIndex()
Tests for Geometry#getSliceIndex.
geometryGetSliceIndexTime()
Test Geometry#getSliceIndex with the optional time argument.
geometryCheckTimeOrigins()
Tests for Geometry#checkTimeOrigins.
geometryNonIntegerTimes()
Tests for Geometry times that are not positive integers.
geometryVolumeIdPosition()
Tests for Geometry#indexToWorld and Geometry#worldToIndex with volume ids.
geometryLargeVolumeIds()
Tests for Geometry volume ids with large values.
geometryCanSyncVolume()
Tests for Geometry#canSyncVolume.
geometryTimeUpdates()
Tests for Geometry time checks and volume ids updates.
geometrySetVolumeValues()
Tests for Geometry#setVolumeValues.
geometrySortOrigins()
Tests for Geometry#sortOrigins.
geometrySortOriginsTilted()
Test that Geometry#sortOrigins sorts along the orientation's normal, not raw world Z, for a tilted geometry.
geometryCanAppendSlice()
Test that Geometry#canAppendSlice tolerates orientation rounding differences between slices of the same series.
imageGetvalue()
Tests for Image getValue.
imageHistogram()
Tests for Image histogram.
imageAppendSlice()
Tests for Image append.
imageAppendSliceWindowPresets()
Tests for Image append slice window presets merge.
imageConvolute2d()
Tests for Image convolute2D.
imageTransform()
Tests for Image transform.
imageCompose()
Tests for Image compose.
imagefactory()
Tests for ImageFactory.
hasvaluesGetoffsets()
Tests for Image hasValues and getOffsets.
clone()
Tests for Image clone.
imageResampleVolumeIds()
Tests for Image#resample of an image with volume ids.
getRescaledValuesAtPosition()
Tests for Image#getRescaledValuesAtPosition.
imageContourGetdistance()
Tests for ImageContour getDistance.
simplerangeIterator()
Tests for simpleRange.
rangeIteratorAxial()
Tests for range.
rangeIteratorCoronal()
Tests for range.
rangeIteratorSagittal()
Tests for range.
rgbIterator()
Tests for simpleRange3d.
getsliceiterator()
Tests for getSliceIterator.
regionIterator()
Tests for rangeRegion.
labelingfilterClass()
Tests for LabelingFilter.
maskSegmentHelperConstructorExisting()
Tests that the constructor reads segments from an existing meta object.
maskSegmentHelperConstructorNoCustom()
Tests that the constructor initialises meta.custom when absent.
maskSegmentHelperConstructorNoSegments()
Tests that the constructor adds a segments array when meta.custom exists but has no segments property.
maskSegmentHelperGetMask()
Tests that getMask returns the mask passed to the constructor.
maskSegmentHelperHasGetSegment()
Tests hasSegment and getSegment for present and absent segments.
maskSegmentHelperCount()
Tests that getNumberOfSegments tracks additions and removals.
maskSegmentHelperAddRgb()
Tests that addSegment calls updatePaletteColourMap when displayRGBValue is set.
maskSegmentHelperAddDuplicate()
Tests that addSegment does not add a segment with a duplicate number.
maskSegmentHelperRemove()
Tests that removeSegment removes an existing segment.
maskSegmentHelperRemoveUnknown()
Tests that removeSegment is a no-op for an unknown segment number.
maskSegmentHelperUpdate()
Tests that updateSegment replaces an existing segment in-place.
maskSegmentHelperUpdateUnknown()
Tests that updateSegment is a no-op for an unknown segment number.
maskSegmentHelperMaskHasSegmentsDisplay()
Tests that maskHasSegments passes displayValue to hasValues.
maskSegmentHelperMaskHasSegmentsNumber()
Tests that maskHasSegments falls back to segment.number when displayValue is absent.
maskSegmentHelperMaskHasSegmentsUnknown()
Tests that maskHasSegments inserts false for unknown segment numbers.
maskSegmentHelperFindOverlapEmpty()
Tests that findOverlap returns empty when neither mask has labelled voxels.
maskSegmentHelperFindOverlapIdentical()
Tests findOverlap when two masks share the same geometry and identical pixel values — every labelled voxel overlaps 100%.
maskSegmentHelperFindOverlapNone()
Tests findOverlap when the two masks have no overlapping labelled voxels.
maskSegmentHelperFindOverlapPartial()
Tests findOverlap with partial overlap between segments.
maskSegmentHelperFindOverlap()
Tests for MaskSegmentHelper findOverlap.
maskSegmentViewHelperIsHiddenInitial()
Tests that isHidden returns false for a segment never added.
maskSegmentViewHelperAddToHidden()
Tests that a segment is hidden after addToHidden.
maskSegmentViewHelperAddDuplicate()
Tests that addToHidden is a no-op for an already-hidden segment.
maskSegmentViewHelperRemoveFromHidden()
Tests that removeFromHidden unhides a hidden segment.
maskSegmentViewHelperRemoveUnknown()
Tests that removeFromHidden is a no-op for a segment not in the list.
maskSegmentViewHelperMultiple()
Tests that multiple segments can be independently hidden and shown.
isLutBitsStored()
Tests for isLutBitsStored.
modalityLutClass()
Tests for ModalityLut.
positionHelperGetGeometry()
Tests that getGeometry returns the image geometry.
positionHelperGetScrollDim()
Tests that getScrollDimIndex returns the view scroll dim.
positionHelperGetMaxDimValue()
Tests getMaximumDimValue for each axis.
positionHelperGetMaxScrollValue()
Tests that getMaximumScrollValue returns the max along the scroll dim.
positionHelperGetCurrentPosition()
Tests that getCurrentPosition matches the initial position.
positionHelperGetCurrentIndex()
Tests that getCurrentIndex matches the initial index.
positionHelperGetCurrentDimValue()
Tests getCurrentPositionDimValue for each axis.
positionHelperGetCurrentScrollValue()
Tests that getCurrentPositionScrollValue returns the scroll-axis index.
positionHelperGetCurrentAtDimValue()
Tests getCurrentPositionAtDimValue: modifies one dim, keeps others.
positionHelperGetCurrentAtScrollValue()
Tests getCurrentPositionAtScrollValue: modifies the scroll axis.
positionHelperSetPosition()
Tests that setCurrentPosition updates the current position.
positionHelperSetPositionUndefined()
Tests that setCurrentPosition with undefined returns false without update.
positionHelperInBounds()
Tests isPositionInBounds for positions inside and outside the geometry.
positionHelperSetSafe()
Tests setCurrentPositionSafe rejects an out-of-bounds position.
positionHelperGetIncDec()
Tests getIncrementPosition and getDecrementPosition return the neighbouring world points without moving.
positionHelperIncrement()
Tests that incrementPosition moves when in bounds and fails at the max.
positionHelperDecrement()
Tests that decrementPosition moves when in bounds and fails at zero.
positionHelperScrollIncDec()
Tests incrementPositionAlongScroll and decrementPositionAlongScroll.
positionHelperMergeIncompatible()
Tests that merge throws when the two helpers have different scroll dims.
positionHelperMergeCompatible()
Tests that merge extends the geometry along the scroll dimension.
resamplingfilterClass()
Tests for ResamplingFilter.
generateWorkerMessages4D()
Tests that generateWorkerMessages passes a view on each frame data for 4D data.
resamplingTaskStartMessage()
Tests that the resampling task start message holds a compact copy of the frame data and transfers it.
sizeClass()
Tests for Size.
indexToAndFromOffset()
Tests for Size.indexToOffset.
indexNormalisePoint()
Tests for Size.normalisePoint.
sizeNormaliseIndex()
Tests for Size.normaliseIndex.
spacingClass()
Tests for Spacing.
viewWlchangeEvent()
Tests for View listeners.
playbackMilliseconds()
Tests for View getImage meta.
generateDataMono()
Tests for View generateImageData MONO.
generateDataMonoWithRsi()
Tests for View generateImageData MONO with RSI.
generateDataMonoFloat()
Tests for View generateImageData MONO with float data.
generateDataMonoInt32()
Tests for View generateImageData MONO with 32 bits integer data.
generateDataMonoNoBitsStored()
Tests for View generateImageData MONO with integer data and no bits stored.
generateDataRgb()
Tests for View generateImageData RGB.
generateDataTiming()
Tests for View generateImageData timing.
viewInitialIndex()
Tests for View initial index.
viewMonochromeBasic()
Tests for generateImageDataMonochrome basic RGBA mapping.
viewMonochromeWindowing()
Tests that the window LUT mapping is applied before colour-map lookup.
viewMonochromeAlphaArgs()
Tests that the alpha function receives the raw pixel value (not the windowed one) together with its position index.
viewMonochromeEmpty()
Tests for generateImageDataMonochrome with an empty iterator.
viewPaletteColor8bit()
Tests for generateImageDataPaletteColor with 8-bit data.
viewPaletteColor16bit()
Tests for generateImageDataPaletteColor with 16-bit stored data.
viewPaletteColorAlpha()
Tests for generateImageDataPaletteColor alpha function.
viewPaletteColorEmpty()
Tests for generateImageDataPaletteColor empty iterator.
viewPaletteColor16bitLog()
Tests for generateImageDataPaletteColor 16-bit logging.
viewRgbBasic()
Tests for generateImageDataRgb basic RGBA mapping.
viewRgbAlphaArgs()
Tests that the alpha function receives the full RGB triplet and the position index, and that the returned value is stored in the alpha byte.
viewRgbEmpty()
Tests for generateImageDataRgb with an empty iterator.
viewRgbNoConversion()
Tests that no colour conversion is applied — values are copied as-is. Verifies the function does not mix up channels.
viewYbrFullBasic()
Tests for generateImageDataYbrFull basic RGBA mapping.
viewYbrFullNeutralChroma()
Tests that neutral chroma (Cb = Cr = 128) produces R = G = B = Y.
viewYbrFullAlphaArgs()
Tests that the alpha function receives the full YBR triplet and index.
viewYbrFullEmpty()
Tests for generateImageDataYbrFull with an empty iterator.
viewYbrFullClamping()
Tests that out-of-range floating-point RGB results are clamped to [0,255].
voiLutLinearFunctionClass()
Tests for VoiLutLinearFunction.
voiLutSigmoidFunctionClass()
Tests for VoiLutSigmoidFunction.
windowLevelClass()
Tests for WindowLevel.
validateWindowLevel()
Tests for validateWindowLevel.
getMinWindowWidth()
Tests for getMinWindowWidth.
windowLutClass()
Tests for WindowLut.