|
@@ -0,0 +1,258 @@
|
|
|
+import React from 'react';
|
|
|
+import { Layout, Button, Typography, Flex } from 'antd';
|
|
|
+import { ArrowLeftOutlined } from '@ant-design/icons';
|
|
|
+import { useDispatch, useSelector } from 'react-redux';
|
|
|
+import { switchToOperationPanel } from '../../../states/panelSwitchSliceForView';
|
|
|
+import {
|
|
|
+ setProcessingMode,
|
|
|
+ performWindowAction,
|
|
|
+ type ProcessingMode,
|
|
|
+ type WindowAction,
|
|
|
+} from '../../../states/view/advancedProcessingPanelSlice';
|
|
|
+import { RootState } from '../../../states/store';
|
|
|
+import Icon from '@/components/Icon';
|
|
|
+
|
|
|
+const { Header, Content } = Layout;
|
|
|
+const { Title } = Typography;
|
|
|
+
|
|
|
+// 处理模式按钮组件
|
|
|
+const ModeButton = ({
|
|
|
+ title,
|
|
|
+ mode,
|
|
|
+ isSelected,
|
|
|
+}: {
|
|
|
+ title: string;
|
|
|
+ mode: ProcessingMode;
|
|
|
+ isSelected: boolean;
|
|
|
+}) => {
|
|
|
+ const dispatch = useDispatch();
|
|
|
+
|
|
|
+ const handleClick = () => {
|
|
|
+ dispatch(setProcessingMode(mode));
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Button
|
|
|
+ onClick={handleClick}
|
|
|
+ style={{
|
|
|
+ flex: 1,
|
|
|
+ fontSize: '14px',
|
|
|
+ backgroundColor: isSelected ? '#d4a373' : undefined,
|
|
|
+ color: isSelected ? '#000' : undefined,
|
|
|
+ borderColor: isSelected ? '#d4a373' : undefined,
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {title}
|
|
|
+ </Button>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 窗宽窗位调整按钮组件
|
|
|
+const WindowButton = ({
|
|
|
+ action,
|
|
|
+ iconName,
|
|
|
+}: {
|
|
|
+ action: WindowAction;
|
|
|
+ iconName: string;
|
|
|
+}) => {
|
|
|
+ const dispatch = useDispatch();
|
|
|
+
|
|
|
+ const handleClick = () => {
|
|
|
+ dispatch(performWindowAction(action));
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Button
|
|
|
+ onClick={handleClick}
|
|
|
+ icon={
|
|
|
+ iconName ? (
|
|
|
+ <Icon
|
|
|
+ module="module-process"
|
|
|
+ name={iconName}
|
|
|
+ userId="base"
|
|
|
+ theme="default"
|
|
|
+ size="2x"
|
|
|
+ state="normal"
|
|
|
+ />
|
|
|
+ ) : undefined
|
|
|
+ }
|
|
|
+ style={{
|
|
|
+ width: '1.5rem',
|
|
|
+ height: '1.5rem',
|
|
|
+ padding: 0,
|
|
|
+ backgroundColor: '#333',
|
|
|
+ borderColor: '#555',
|
|
|
+ }}
|
|
|
+ title={action}
|
|
|
+ />
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+// 曲线显示组件(静态)
|
|
|
+const CurveDisplay = () => {
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ width: '100%',
|
|
|
+ height: '240px',
|
|
|
+ backgroundColor: '#2a2a2a',
|
|
|
+ borderRadius: '4px',
|
|
|
+ position: 'relative',
|
|
|
+ marginTop: '12px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <svg
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ viewBox="0 0 300 240"
|
|
|
+ style={{ display: 'block' }}
|
|
|
+ >
|
|
|
+ {/* 网格背景 */}
|
|
|
+ <defs>
|
|
|
+ <pattern
|
|
|
+ id="grid"
|
|
|
+ width="30"
|
|
|
+ height="24"
|
|
|
+ patternUnits="userSpaceOnUse"
|
|
|
+ >
|
|
|
+ <path
|
|
|
+ d="M 30 0 L 0 0 0 24"
|
|
|
+ fill="none"
|
|
|
+ stroke="#444"
|
|
|
+ strokeWidth="0.5"
|
|
|
+ />
|
|
|
+ </pattern>
|
|
|
+ </defs>
|
|
|
+ <rect width="300" height="240" fill="url(#grid)" />
|
|
|
+
|
|
|
+ {/* 直方图柱状图 */}
|
|
|
+ <g opacity="0.5">
|
|
|
+ {Array.from({ length: 50 }, (_, i) => {
|
|
|
+ const x = (i * 300) / 50;
|
|
|
+ const height = Math.random() * 180 + 20;
|
|
|
+ const y = 240 - height;
|
|
|
+ return (
|
|
|
+ <rect
|
|
|
+ key={i}
|
|
|
+ x={x}
|
|
|
+ y={y}
|
|
|
+ width="5"
|
|
|
+ height={height}
|
|
|
+ fill="#888"
|
|
|
+ />
|
|
|
+ );
|
|
|
+ })}
|
|
|
+ </g>
|
|
|
+
|
|
|
+ {/* S型曲线 */}
|
|
|
+ <path
|
|
|
+ d="M 20,200 Q 80,180 120,120 T 280,40"
|
|
|
+ stroke="#fff"
|
|
|
+ strokeWidth="2"
|
|
|
+ fill="none"
|
|
|
+ />
|
|
|
+
|
|
|
+ {/* 可拖拽点(暂不实现交互) */}
|
|
|
+ <circle cx="20" cy="200" r="5" fill="#fff" stroke="#000" />
|
|
|
+ <rect
|
|
|
+ x="115"
|
|
|
+ y="115"
|
|
|
+ width="10"
|
|
|
+ height="10"
|
|
|
+ fill="#fff"
|
|
|
+ stroke="#000"
|
|
|
+ />
|
|
|
+ <circle cx="280" cy="40" r="5" fill="#fff" stroke="#000" />
|
|
|
+ </svg>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+const AdvancedProcessingPanel = () => {
|
|
|
+ const dispatch = useDispatch();
|
|
|
+ const selectedMode = useSelector(
|
|
|
+ (state: RootState) => state.advancedProcessingPanel.selectedMode
|
|
|
+ );
|
|
|
+
|
|
|
+ const handleReturn = () => {
|
|
|
+ dispatch(switchToOperationPanel());
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Layout className="h-full">
|
|
|
+ {/* 顶部导航栏 */}
|
|
|
+ <Header
|
|
|
+ style={{
|
|
|
+ display: 'flex',
|
|
|
+ alignItems: 'center',
|
|
|
+ padding: '0 16px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Button
|
|
|
+ type="text"
|
|
|
+ icon={<ArrowLeftOutlined />}
|
|
|
+ onClick={handleReturn}
|
|
|
+ />
|
|
|
+ <Title level={5} style={{ margin: 0, lineHeight: '48px' }}>
|
|
|
+ 图像处理
|
|
|
+ </Title>
|
|
|
+ </Header>
|
|
|
+
|
|
|
+ {/* 主体内容 */}
|
|
|
+ <Content
|
|
|
+ style={{ padding: '16px', maxHeight: '100%', overflowY: 'auto' }}
|
|
|
+ >
|
|
|
+ {/* 快捷功能按钮区域 */}
|
|
|
+ <Flex gap="small" style={{ marginBottom: '16px' }}>
|
|
|
+ <ModeButton
|
|
|
+ title="均衡"
|
|
|
+ mode="均衡"
|
|
|
+ isSelected={selectedMode === '均衡'}
|
|
|
+ />
|
|
|
+ <ModeButton
|
|
|
+ title="高对比"
|
|
|
+ mode="高对比"
|
|
|
+ isSelected={selectedMode === '高对比'}
|
|
|
+ />
|
|
|
+ </Flex>
|
|
|
+ <Flex gap="small" style={{ marginBottom: '16px' }}>
|
|
|
+ <ModeButton
|
|
|
+ title="锐组织"
|
|
|
+ mode="锐组织"
|
|
|
+ isSelected={selectedMode === '锐组织'}
|
|
|
+ />
|
|
|
+ <ModeButton
|
|
|
+ title="骨骼"
|
|
|
+ mode="骨骼"
|
|
|
+ isSelected={selectedMode === '骨骼'}
|
|
|
+ />
|
|
|
+ </Flex>
|
|
|
+
|
|
|
+ {/* 窗宽窗位调整工具 */}
|
|
|
+ <Flex gap="small" style={{ marginBottom: '12px' }}>
|
|
|
+ <WindowButton action="减小窗宽" iconName="btn_DecreaseWindowWidth" />
|
|
|
+ <WindowButton action="增大窗宽" iconName="btn_IncreaseWindowWidth" />
|
|
|
+ <WindowButton action="减小窗位" iconName="btn_DecreaseWindowLevel" />
|
|
|
+ <WindowButton action="增大窗位" iconName="btn_IncreaseWindowLevel" />
|
|
|
+ </Flex>
|
|
|
+
|
|
|
+ {/* 曲线显示区域 */}
|
|
|
+ <CurveDisplay />
|
|
|
+
|
|
|
+ {/* 底部高级按钮 */}
|
|
|
+ <Button
|
|
|
+ style={{
|
|
|
+ width: '100%',
|
|
|
+ marginTop: '16px',
|
|
|
+ height: '40px',
|
|
|
+ fontSize: '14px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 高级
|
|
|
+ </Button>
|
|
|
+ </Content>
|
|
|
+ </Layout>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+export default AdvancedProcessingPanel;
|