38、X-Tract:胸部特征灵活提取框架的研究与应用

X-Tract:胸部特征灵活提取框架的研究与应用

一、图像纹理描述符

图像纹理分析通常是非侵入性的。通过从图像像素中提取聚合度量/原始统计数据,并了解各个区域的空间分布,技术人员能够更好地理解图像并对病理进行适当分类。放射组学是一种出色的特征提取技术,它将图像转换为详尽的多维数据,用于数据挖掘。结合临床和实验室报告检查,这些聚合度量可以辅助精确诊断,或改善和/或改变各种病例的治疗反应。提取的定量特征还可用于纹理区分,从而实现更好的纹理分割。

统计模型分为一阶、二阶和高阶,还有一些是空间模型。一阶统计包含色调值的集中趋势度量(如均值、标准差、偏度、峰度等)。二阶统计(由像素对给出的统计数据),如灰度共生矩阵(GLCM),用于生成纹理特征的共现测量,根据其游程长度可分为精细或粗糙。此外,还有游程长度矩阵、区域大小矩阵和邻域灰度差矩阵等有效测量方法,用于测量各种像素的空间排列。除了基于欧几里得距离的特征外,还有分形维数等特征,用于测量不规则轮廓的复杂性,以及傅里叶、加博尔和小波等变换方法,也用于各种纹理分割任务。

当前框架提供了一阶统计特征、灰度共生矩阵(GLCM)、加博尔滤波器、局部二值模式(LBP)、快速傅里叶变换(FFT)和小波等功能。

  • 快速傅里叶变换(FFT) :FFT 是一个频域函数,可应用于输入图像。其公式如下:
    [
    X(t)=\frac{1}{2\pi}\int_{-\infty}^{+\infty}X(j\omega)e^{j\omega t}d\omega
    ]
    其中 (e^{j\omega t}=\cos(\omega t)+j\sin(\omega t))

HowContractPrint() { const filteredtaB = this.iP_ContractList.filter(item => { // 检查对象是否有至少一个自有属性 return Object.keys(item).length > 0; }); // 验证每个非空对象的所有字段是否都有值 const isValid = filteredtaB.every(item => { return item.hmi_MoldNumber && item.hmi_ProductModle && item.hmi_MoldName && item.hmi_MoldMaterial && item.hmi_MoldDesrilbe && item.hmi_MoldPric && item.hmi_MoldClass; }); if (!isValid) { this.messageToggle("error", "请填写完整所有必填字段"); return; } // 1. 获取要打印的 DOM 节点 const printContent = this.$refs.AddContract.$el.querySelector('#contract-content'); // 2. 克隆节点(避免影响原页面) const printNode = printContent.cloneNode(true); const DeleClass = printNode.querySelectorAll('.sticky-header'); DeleClass.forEach(header => { header.classList.remove('sticky-header'); // 如果需要,可以添加替代样式 // header.style.position = 'static'; }); // 3. 创建隐藏的 iframe const iframe = document.createElement("iframe"); iframe.style.position = "fixed"; iframe.style.right = "0"; iframe.style.bottom = "0"; iframe.style.width = "0"; iframe.style.height = "0"; iframe.style.border = "none"; iframe.style.opacity = "0"; document.body.appendChild(iframe); const headerHTML = ` <div class="print-header"> <uni-col span="24" class="mb-2"> <view class="cu-bar solid-b-1" style="min-height:80px;"> <img class="tract-image" src="/static/logo-title.png"></img> <view class="mr-2" style="display: flex;flex-direction: column;align-items: flex-end;"> <text style="font-size: 16px;">${this.company_CN}</text> <text style="font-size: 12px;">${this.company_EN}</text> </view> </view> <view class="flex-right mr-3 mt-1" style="color: rgba(0, 0, 0, 0.6);"> 合同编号:<span>${this.iP_MoldContractNo}</span> </view> </uni-col> </div> `; // 4. 插入打印内容 iframe.contentDocument.body.appendChild(printNode); // 5. 复制所有样式(防止样式丢失) const styles = Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')); styles.forEach(style => { iframe.contentDocument.head.appendChild(style.cloneNode(true)); }); // 6. 关键:强制分页逻辑 + 固定缩放比例 const fixScaleStyle = document.createElement("style"); fixScaleStyle.textContent = ` /* 打印时移除所有滚动条 */ ::-webkit-scrollbar { display: none !important; } /* 强制scroll-view展开内容 */ #contract-content { overflow: visible !important; height: auto !important; display: block !important; width: 100% !important; min-height: 100vh !important; /* 使用视口高度确保铺满 */ } /* 隐藏原生滚动容器(如果有) */ .uni-scroll-view, .uni-scroll-view-content { overflow: visible !important; height: auto !important; } /* 头部标题栏 -- 图片 */ .tract-image { width: 230px; height: 60px; transform: scale(0.8); } /* 头部标题栏 */ .print-header { position: fixed; top: 0; width: 100%; page-break-after: always; height: 120px; /* 匹配页眉实际高度 */ background: white; // z-index: 1; } @page { size: A4; /* 固定A4尺寸 */ margin: 10mm; /* 适当边距 */ @bottom-center { content: "${this.iP_MoldContractNo} - 第 " counter(page) " 页"; font-size: 12px; color: rgba(0, 0, 0, 0.5); margin-bottom: 20px !important; } // @top-center { // content: ''; // font-size: 18px; // color: #333; // margin-top: 15px !important; // } // @top-left { // content: ''; // } // @top-right { // content: "${this.iP_MoldContractNo}"; // margin-top: 15px !important; // } } body { width: 100% !important; margin: 0 !important; padding: 0 !important; zoom: 1 !important; /* 禁止缩放 */ // transform: scaleY(1) !important; } /* 分页控制:避免内容被截断 */ .page-break { page-break-after: always; /* 强制分页 */ } .no-break { page-break-inside: avoid; /* 禁止分页中断 */ } /* 打印时隐藏不必要的元素 */ @media print { .no-print { display: none !important; } } .tract-view { // display: flex; font-size: 18px !important; margin-bottom: 10px !important; } .tract-view-ic { disolay: none !important; visibility: hidden !important; } .tract-view-22 { // display: flex; font-size: 18px !important; margin-bottom: 10px !important; } /* 解除内表宽高限制 */ .tract-view-M2 { height: auto !important; overflow: visible !important; } .tract-top-50 { margin-top: 50px !important; } .tract-top-30 { margin-top: 30px !important; } .tract-B-width { width: 400px !important; } .tract-view-left { margin-left: 120px !important; } .tract-header { font-size: 18px !important; } .tract-span-T { margin-top: 50px !important; } .textarae-font-Td { height: 100px !important; } /* 隐藏提交区域 */ .Footer-button { disolay: none !important; visibility: hidden !important; } `; iframe.contentDocument.head.appendChild(fixScaleStyle); // 8. 打印 setTimeout(() => { iframe.contentWindow.focus(); iframe.contentWindow.print(); // 打印完成后移除 iframe setTimeout(() => { document.body.removeChild(iframe); }, 1000); }, 500); },,将const headerHTML = ` <div class="print-header"> <uni-col span="24" class="mb-2"> <view class="cu-bar solid-b-1" style="min-height:80px;"> <img class="tract-image" src="/static/logo-title.png"></img> <view class="mr-2" style="display: flex;flex-direction: column;align-items: flex-end;"> <text style="font-size: 16px;">${this.company_CN}</text> <text style="font-size: 12px;">${this.company_EN}</text> </view> </view> <view class="flex-right mr-3 mt-1" style="color: rgba(0, 0, 0, 0.6);"> 合同编号:<span>${this.iP_MoldContractNo}</span> </view> </uni-col> </div> `;放在每一页 的头部,打印内容文字重叠
08-15
在使用 `iframe` 打印功能时,若希望在每一页的顶部显示指定的 HTML 头部内容,但遇到了头部内容打印内容文字重叠的问题,可以通过以下方式解决: ### 使用 `@page` 规则设置页边距 在 CSS 中,通过 `@page` 规则可以控制打印页面的布局,包括设置页边距,从而避免头部内容正文内容的重叠问题。可以在 `iframe` 页面中添加如下样式: ```css @media print { @page { margin-top: 50px; /* 根据头部高度调整 */ } body { padding-top: 30px; /* 确保内容不被头部覆盖 */ } .print-header { position: fixed; top: 0; left: 0; right: 0; height: 30px; background-color: #f8f8f8; text-align: center; line-height: 30px; font-weight: bold; z-index: 9999; } } ``` 通过设置 `@page` 的 `margin-top`,可以为每一页的顶部留出空间,避免内容被固定定位的头部遮挡。同时,为 `body` 设置 `padding-top`,确保页面内容不会被固定定位的头部覆盖[^1]。 ### 使用 `position: fixed` 定位头部内容 为了确保头部内容在每一页的顶部显示,可以将头部元素设置为 `position: fixed`,并将其定位到页面顶部。需要注意的是,固定定位的元素不会随页面滚动而移动,因此在设置时应确保其高度 `@page` 中的 `margin-top` 一致,以避免内容重叠。 ```html <div class="print-header">这是每页顶部的标题栏</div> ``` ### 通过 JavaScript 动态调整打印内容 如果 `iframe` 中的内容是动态生成的,可以通过 JavaScript 在打印前动态插入头部内容,并在打印完成后移除该内容,以避免影响页面的正常显示。 ```javascript window.onbeforeprint = function () { const header = document.createElement('div'); header.className = 'print-header'; header.textContent = '这是每页顶部的标题栏'; document.body.insertBefore(header, document.body.firstChild); }; window.onafterprint = function () { const header = document.querySelector('.print-header'); if (header) { header.remove(); } }; ``` ### 使用独立的打印页面 如果 `iframe` 中的内容较为复杂,或者需要更精细地控制打印样式,可以考虑创建一个专门用于打印的页面。该页面仅包含需要打印的内容,并通过 `iframe` 加载该页面进行打印。这种方式可以避免主页面中其他样式对打印内容的影响,同时也能更好地控制页面布局。 例如,创建一个 `print.html` 文件: ```html <!DOCTYPE html> <html> <head> <title>Print Page</title> <style> @media print { @page { margin-top: 50px; } body { padding-top: 30px; } .print-header { position: fixed; top: 0; left: 0; right: 0; height: 30px; background-color: #f8f8f8; text-align: center; line-height: 30px; font-weight: bold; z-index: 9999; } } </style> </head> <body> <div class="print-header">这是每页顶部的标题栏</div> <div id="content"> <!-- 打印内容 --> </div> </body> </html> ``` 然后在主页面中使用 `iframe` 加载该文件,并通过 JavaScript 触发打印操作: ```html <iframe id="printFrame" src="print.html" style="display:none;"></iframe> ``` ```javascript document.getElementById('printFrame').contentWindow.print(); ``` ### 注意事项 由于浏览器的打印机制不同,某些默认样式(如页眉、页脚)可能无法完全通过 CSS 控制。在这种情况下,建议用户手动调整浏览器的打印设置,例如取消勾选“页眉/页脚”选项,以获得更干净的打印输出。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值