|
@@ -22,7 +22,8 @@ import {
|
|
|
selectError,
|
|
|
selectCurrentImageId,
|
|
|
} from '../../../states/view/sliderAdjustmentPanelSlice';
|
|
|
-import { getProcessedDcm } from '../../../API/imageActions';
|
|
|
+import { buildProcessedDcmUrl } from '../../../API/imageActions';
|
|
|
+import { updateViewerUrl } from '../../../states/view/viewerContainerSlice';
|
|
|
import { PARAMETER_RANGES, ALGORITHM_OPTIONS } from '../../../domain/processingPresets';
|
|
|
import { LUT_OPTIONS } from '../../../domain/lutConfig';
|
|
|
import type { ProcessingStyle, LUTType, FullProcessingParams } from '../../../types/imageProcessing';
|
|
@@ -88,7 +89,7 @@ const SliderAdjustmentPanel = () => {
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
- * 防抖获取预览图像
|
|
|
+ * 防抖更新预览图像URL
|
|
|
*/
|
|
|
const debouncedPreview = useCallback(
|
|
|
(params: FullProcessingParams) => {
|
|
@@ -103,36 +104,42 @@ const SliderAdjustmentPanel = () => {
|
|
|
}
|
|
|
|
|
|
// 设置新的定时器
|
|
|
- saveTimerRef.current = setTimeout(async () => {
|
|
|
+ saveTimerRef.current = setTimeout(() => {
|
|
|
if (currentImageId) {
|
|
|
try {
|
|
|
- // 调用GET API获取处理后的dcm
|
|
|
- const dcmBlob = await getProcessedDcm(currentImageId, {
|
|
|
+ // 获取原始URL
|
|
|
+ const dcmUrls = store.getState().viewerContainer.selectedViewers;
|
|
|
+ if (dcmUrls.length !== 1) {
|
|
|
+ console.error('没有选中的图像或者数量大于1,无法更新预览');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const originalUrl = dcmUrls[0];
|
|
|
+
|
|
|
+ // 构建处理后的dcm URL(带参数)
|
|
|
+ const processedUrl = buildProcessedDcmUrl(currentImageId, {
|
|
|
contrast: params.contrast.toString(),
|
|
|
detail: params.detail.toString(),
|
|
|
latitude: params.latitude.toString(),
|
|
|
noise: params.noise.toString(),
|
|
|
});
|
|
|
|
|
|
- // 创建Blob URL
|
|
|
- const blobUrl = URL.createObjectURL(dcmBlob);
|
|
|
+ // 更新viewer URL以触发重新渲染
|
|
|
+ dispatch(updateViewerUrl({
|
|
|
+ originalUrl,
|
|
|
+ newUrl: `dicomweb:${processedUrl}`,
|
|
|
+ }));
|
|
|
|
|
|
- // TODO: 这里需要刷新Cornerstone显示
|
|
|
- // 目前先在控制台输出,后续需要实现图像刷新逻辑
|
|
|
- console.log('预览图像URL:', blobUrl);
|
|
|
+ console.log('已更新预览图像URL:', processedUrl);
|
|
|
console.log('参数:', params);
|
|
|
|
|
|
- // 提示:需要在这里更新Viewer显示
|
|
|
- message.info('预览图像已生成(待实现图像刷新)');
|
|
|
-
|
|
|
} catch (error) {
|
|
|
- console.error('获取预览图像失败:', error);
|
|
|
- message.error('获取预览图像失败');
|
|
|
+ console.error('更新预览图像失败:', error);
|
|
|
+ message.error('更新预览图像失败');
|
|
|
}
|
|
|
}
|
|
|
}, 500); // 500ms 防抖延迟
|
|
|
},
|
|
|
- [currentImageId, isInitialLoad]
|
|
|
+ [currentImageId, isInitialLoad, dispatch]
|
|
|
);
|
|
|
|
|
|
/**
|