feat: temp save

This commit is contained in:
mozzie 2023-09-22 17:04:02 +08:00
parent 6f62e35ff3
commit 7877259057
15 changed files with 535 additions and 458 deletions

View File

@ -22,7 +22,12 @@
"@tavi/util": "1.0.0", "@tavi/util": "1.0.0",
"js-cookie": "3.0.5", "js-cookie": "3.0.5",
"three": "0.156.1", "three": "0.156.1",
"path-to-regexp": "6.2.1" "path-to-regexp": "6.2.1",
"@cornerstonejs/core": "1.16.5",
"dicom-parser": "1.8.21",
"cornerstone-wado-image-loader": "4.13.2",
"@msgpack/msgpack": "3.0.0-beta2",
"pako": "2.1.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.8", "@babel/core": "^7.21.8",

View File

@ -22,4 +22,9 @@ export const proxyMap: TProxyMap = {
changeOrigin: true, changeOrigin: true,
pathRewrite: { "^/api": "" }, pathRewrite: { "^/api": "" },
}, },
"/py": {
target: "http://localhost:5000/",
changeOrigin: true,
pathRewrite: { "^/py": "" },
},
}; };

View File

@ -0,0 +1,62 @@
import { useEffect } from "react";
import { decode } from "@msgpack/msgpack";
import pako from "pako";
import * as cornerstone from "@cornerstonejs/core";
import dicomParser from "dicom-parser";
import cornerstoneWADOImageLoader from "cornerstone-wado-image-loader";
import axios from "axios";
interface DiffViewerProps {
children?: JSX.Element;
}
export const DiffViewer = (props: DiffViewerProps) => {
useEffect(() => {
axios({
url: "/py/get_reference_image",
method: "get",
responseType: "arraybuffer",
})
.then((response) => {
const decompressedData = pako.inflate(new Uint8Array(response.data)); // Use pako to decompress the data
const pixelArray1 = decode(decompressedData); // Decode the data using msgpack
console.log(pixelArray1);
// 请求compressed_data
// for (let i = 2; i < 220; i++) {
// axios
// .get(`/py/get_compressed_data/${i}`)
// .then((response) => {
// const compressedData = response.data.compressed_data;
// // TODO: 根据需要进一步处理数据
// })
// .catch((error) => {
// console.error(
// `Error fetching compressed data for image ${i}:`,
// error
// );
// });
// }
})
.catch((error) => {
console.error("Error fetching reference image:", error);
});
}, []);
useEffect(() => {
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
cornerstoneWADOImageLoader.webWorkerManager.initialize({
maxWebWorkers: navigator.hardwareConcurrency || 1,
startWebWorkersOnDemand: true,
webWorkerPath: "/path/to/cornerstoneWADOImageLoaderWebWorker.js",
taskConfiguration: {
decodeTask: {
codecsPath: "/path/to/cornerstoneWADOImageLoaderCodecs.js",
},
},
});
}, []);
return <div>DiffViewer</div>;
};

View File

@ -0,0 +1,13 @@
import { DiffViewer } from "./DiffViewer";
interface RootViewerProps {
children?: JSX.Element;
}
export const RootViewer = (props: RootViewerProps) => {
return (
<div>
<DiffViewer />
</div>
);
};

View File

@ -1,12 +1,12 @@
import { Navigate, RouteObject } from "react-router"; import { Navigate, RouteObject } from "react-router";
import { Login } from "../modules/Login"; import { Login } from "../modules/Login";
import { PatientList } from "../modules/PatientList"; import { PatientList } from "../modules/PatientList";
import { RootViewer } from "../modules/Root/Viewer/Root";
import { PeripheralViewer } from "../modules/Peripheral"; import { PeripheralViewer } from "../modules/Peripheral";
import { Dashboard } from "@/modules/Dashboard"; import { Dashboard } from "@/modules/Dashboard";
import { ReportFullVersion } from "@/modules/Report/Full"; import { ReportFullVersion } from "@/modules/Report/Full";
import { Layout } from "@/components/Layout"; import { Layout } from "@/components/Layout";
import { ExpandRouteProps } from "."; import { ExpandRouteProps } from ".";
import { RootViewer } from "@/modules/Root/Viewer";
/** /**
* *

View File

@ -136,15 +136,16 @@ export const DicomUpload = (props: DicomUploadProps) => {
* *
*/ */
const onAssignConfirm = async () => { const onAssignConfirm = async () => {
if (!selectAnnotator?.id) return; if (!selectAnnotator) return;
const { code, ignore } = await userDomainService.createArchiveTask( const { code, ignore } = await userDomainService.createArchiveTask(
selectAnnotator, selectAnnotator,
selectRows selectRows
); );
if (code === 0) { if (code === 0) {
const { username = "" } = selectAnnotator;
const info = const info =
ignore?.length > 0 ignore?.length > 0
? `,其中${ignore.length}条序列,用户${selectAnnotator.username}已存在` ? `,其中${ignore.length}条序列,用户${username}已存在`
: ``; : ``;
message.info(`创建任务成功${info}`); message.info(`创建任务成功${info}`);
} }

View File

@ -87,7 +87,7 @@ export const LabelTree = (props: LabelTreeProps) => {
label: ( label: (
<Row> <Row>
<Col span={18}>{item.name}</Col> <Col span={18}>{item.name}</Col>
<Col span={6}> <Col span={6} style={{ textAlign: "right" }}>
<Space> <Space>
<Tooltip title={`编辑 ${item.name} 分类`}> <Tooltip title={`编辑 ${item.name} 分类`}>
<FormOutlined <FormOutlined
@ -98,9 +98,9 @@ export const LabelTree = (props: LabelTreeProps) => {
}} }}
/> />
</Tooltip> </Tooltip>
<Tooltip title={`删除 ${item.name} 分类`}> {/* <Tooltip title={` ${item.name} `}>
<CloseOutlined /> <CloseOutlined />
</Tooltip> </Tooltip> */}
</Space> </Space>
</Col> </Col>
</Row> </Row>
@ -111,7 +111,7 @@ export const LabelTree = (props: LabelTreeProps) => {
<li key={label.id}> <li key={label.id}>
<Row> <Row>
<Col span={18}>{label.name}</Col> <Col span={18}>{label.name}</Col>
<Col span={6}> <Col span={6} style={{ textAlign: "right" }}>
<Space> <Space>
<Tooltip title={`编辑 ${label.name} 标签`}> <Tooltip title={`编辑 ${label.name} 标签`}>
<EditOutlined <EditOutlined

View File

@ -75,7 +75,7 @@ export class AppController {
private readonly configService: ConfigService, private readonly configService: ConfigService,
) {} ) {}
@EventPattern({ cmd: 'dicom.find.dicom' }) @EventPattern('dicom.find')
async findDicoms() { async findDicoms() {
const pacsUrl = this.configService.get('PACS_URL'); const pacsUrl = this.configService.get('PACS_URL');
try { try {

View File

@ -28,8 +28,7 @@
"class-transformer": "0.5.1", "class-transformer": "0.5.1",
"uuid": "9.0.0", "uuid": "9.0.0",
"dayjs": "1.11.9", "dayjs": "1.11.9",
"axios": "1.5.0", "axios": "1.5.0"
"@tavi/message-pattern": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@nestjs/cli": "^10.0.0", "@nestjs/cli": "^10.0.0",

View File

@ -26,9 +26,7 @@ export class AdminController {
@Get('find/dicom/all') @Get('find/dicom/all')
async findDicom() { async findDicom() {
const { data } = await firstValueFrom( const { data } = await firstValueFrom(this.client.send('dicom.find', {}));
this.client.send({ cmd: 'dicom.find.dicom' }, {}),
);
return { code: 0, data }; return { code: 0, data };
} }
} }

File diff suppressed because it is too large Load Diff