npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@whitekite/corps-viewport

v1.4.1

Published

使用基石封装的vue3-dicom查看器组件

Readme

corps-viewport

使用基石封装的vue3-dicom查看器组件

安装

yarn

yarn add @whitekite/corps-viewport

npm

npm i @whitekite/corps-viewport

pnpm

pnpm add @whitekite/corps-viewport

CornerstoneViewport

主要的显示组件

样式

import '@whitekite/corps-viewport/dist/style.css'
// or 
import '@whitekite/corps-viewport/style'

Example

<CornerstoneViewport
  imageIds={item}
  onViewportInit={(element) => {
    if (element) {
      // 元素是否存在,存在则将同步元素更新
      syncElement.value[index] = element
    }
  }}
  tools={tools.value}
  activeTool={activeTool.value}
  synchronizationContext={syncTool.value}
  onImageLoad={(load) => {
    imageLoadList.value[index] = load
  }}
  onSetViewportActive={() => {
    activeKey.value = index
  }}
/>

Util·工具

usePanZoomSynchronizer

移动

/**
 * synchronizationContext的一种
 * @return new Synchronizer('cornerstoneimagerendered', panZoomSynchronizer)
 */
const panZoomSynchronizer = usePanZoomSynchronizer()

useWwwcSynchronizer

调窗同步

/**
 * synchronizationContext的一种
 * @return new Synchronizer('cornerstoneimagerendered', wwwcSynchronizer)
 */
const wwwcSynchronizer = useWwwcSynchronizer()

GridDividingLineTool

自定义胸肺比工具

tools.push({
  name: 'GridDividingLine',
  toolClass: GridDividingLineTool,
  mode: 'disabled',
  modeOptions: {mouseButtonMask: 1},
})

useCornerstoneChangeDicomFileUrl

将普通下载url转为dicomweb标准url

/**
 * 改变url使基石可以直接读dicom文件
 */
const {changeUrlList} = useCornerstoneChangeDicomFileUrl()

imageIds.value[0] = changeUrlList(urlList)

useCornerstoneRegister

注册dicom查看器工具 (必须)

/**
 * 注册基石
 */
useCornerstoneRegister()

useNormalCornerstoneToolList

内置的Cornerstone常用工具数组,可用于便捷注册工具数组

内置工具:

Wwwc

Pan

Zoom

Magnify

Rotate

CobbAngle

Length

Bidirectional

Angle

RectangleRoi

Probe

EllipticalRoi

FreehandRoi

const toolList = useNormalCornerstoneToolList();

<CornerstoneViewport
  imageIds={changeUrlList([])}
  tools={toolList.value}
  activeTool="GridDividingLine"
/>

useCornerstoneResetElements

重置dicom查看器

注意:使用钢笔工具请勿调用此方法

对绘图工具的清空本质上是直接清空工具状态

暂时只能清空工具内写死的绘图工具状态,一键清空,请期待后续更新

如封装额外绘图工具请自行封装该方法

支持清空绘图状态:

FreehandRoi

GridDividingLine

CobbAngle

Length

Bidirectional

Angle

RectangleRoi

Probe

EllipticalRoi

 /**
 * 重置
 * 注意:使用钢笔工具请勿调用此方法
 */
const cornerstoneResetElements = useCornerstoneResetElements(syncElement)

useCornerstoneScreenSizeCalibration

根据屏幕的真实宽度(单位:mm)计算影像真实尺寸显示大小


const calibrateThroughPicture = useCornerstoneScreenSizeCalibration();
/**
 * calibrateThroughPicture(element:读片器的元素,屏幕的真实宽度:mm)
 */
<button onClick={() => calibrateThroughPicture(syncElement.value, 500)}>自适应</button>

useCornerstoneScrollToIndex

指定滚动至序列下标

const scrollToIndex = useCornerstoneScrollToIndex();

<button onClick={() => scrollToIndex(syncElement.value, 1)}>滚动至指定下标</button>

useCornerstonePlayClip

播放序列片

const {
  // 播放状态
  state,
  // 播放状态
  clipState,
  // 播放
  play,
  // 暂停
  stop,
  // 切换播放状态
  toggle,
  // 播放
  playClip,
  // 暂停
  stopClip,
  // 切换播放状态
  toggleClip,
} = useCornerstonePlayClip();

/**
 * 播放
 * @param element 读片器所在元素
 * @param frame 播放帧数
 */
playClip(syncElement.value, 24)

/**
 * 暂停
 * @param element 读片器所在元素
 */
stopClip(syncElement.value)

/**
 * 切换播放状态
 * @param element 读片器所在元素
 * @param frame 播放帧数
 */
toggleClip(syncElement.value, 24)