fix(dicomlocal): navigate /local to the work list and /localbasic to the (basic) viewer (#3389)
* fix(dicomlocal): navigate /local to the work list and /localbasic to the (basic) viewer For TMTV, consider both the forward and back slash separator for modalities. * Fix to TMTV isValidMode method. * PR feedback: - replace forward slashes with back slashes for modalities in the WorkList instead of in the Mode. * Added query.series to DicomLocalDataSource.
This commit is contained in:
parent
af8bb27575
commit
52eb0edd6f
@ -1,4 +1,4 @@
|
||||
import { DicomMetadataStore, IWebApiDataSource } from '@ohif/core';
|
||||
import { DicomMetadataStore, IWebApiDataSource, utils } from '@ohif/core';
|
||||
import OHIF from '@ohif/core';
|
||||
import dcmjs from 'dcmjs';
|
||||
|
||||
@ -87,7 +87,7 @@ function createDicomLocalApi(dicomLocalConfig) {
|
||||
date: firstInstance.StudyDate,
|
||||
description: firstInstance.StudyDescription,
|
||||
mrn: firstInstance.PatientID,
|
||||
patientName: { Alphabetic: firstInstance.PatientName },
|
||||
patientName: utils.formatPN(firstInstance.PatientName),
|
||||
studyInstanceUid: firstInstance.StudyInstanceUID,
|
||||
time: firstInstance.StudyTime,
|
||||
//
|
||||
@ -103,9 +103,20 @@ function createDicomLocalApi(dicomLocalConfig) {
|
||||
},
|
||||
},
|
||||
series: {
|
||||
// mapParams: mapParams.bind(),
|
||||
search: () => {
|
||||
console.debug(' DICOMLocal QUERY SERIES SEARCH');
|
||||
search: studyInstanceUID => {
|
||||
const study = DicomMetadataStore.getStudy(studyInstanceUID);
|
||||
return study.series.map(aSeries => {
|
||||
const firstInstance = aSeries?.instances[0];
|
||||
return {
|
||||
studyInstanceUid: studyInstanceUID,
|
||||
seriesInstanceUid: firstInstance.SeriesInstanceUID,
|
||||
modality: firstInstance.Modality,
|
||||
seriesNumber: firstInstance.SeriesNumber,
|
||||
seriesDate: firstInstance.SeriesDate,
|
||||
numSeriesInstances: aSeries.instances.length,
|
||||
description: firstInstance.SeriesDescription,
|
||||
};
|
||||
});
|
||||
},
|
||||
},
|
||||
instances: {
|
||||
|
||||
@ -40,7 +40,11 @@ const getLoadButton = (onDrop, text, isDir) => {
|
||||
);
|
||||
};
|
||||
|
||||
function Local() {
|
||||
type LocalProps = {
|
||||
modePath: string;
|
||||
};
|
||||
|
||||
function Local({ modePath }: LocalProps) {
|
||||
const navigate = useNavigate();
|
||||
const dropzoneRef = useRef();
|
||||
const [dropInitiated, setDropInitiated] = React.useState(false);
|
||||
@ -64,8 +68,6 @@ function Local() {
|
||||
'@ohif/extension-dicom-microscopy'
|
||||
);
|
||||
|
||||
let modePath = 'viewer';
|
||||
|
||||
const onDrop = async acceptedFiles => {
|
||||
const studies = await filesToStudies(acceptedFiles, dataSource);
|
||||
|
||||
@ -93,8 +95,9 @@ function Local() {
|
||||
|
||||
// Todo: navigate to work list and let user select a mode
|
||||
studies.forEach(id => query.append('StudyInstanceUIDs', id));
|
||||
query.append('datasources', 'dicomlocal');
|
||||
|
||||
navigate(`/${modePath}/dicomlocal?${decodeURIComponent(query.toString())}`);
|
||||
navigate(`/${modePath}?${decodeURIComponent(query.toString())}`);
|
||||
};
|
||||
|
||||
// Set body style
|
||||
|
||||
@ -339,7 +339,11 @@ function WorkList({
|
||||
{appConfig.loadedModes.map((mode, i) => {
|
||||
const isFirst = i === 0;
|
||||
|
||||
const isValidMode = mode.isValidMode({ modalities });
|
||||
const modalitiesToCheck = modalities.replaceAll('/', '\\');
|
||||
|
||||
const isValidMode = mode.isValidMode({
|
||||
modalities: modalitiesToCheck,
|
||||
});
|
||||
// TODO: Modes need a default/target route? We mostly support a single one for now.
|
||||
// We should also be using the route path, but currently are not
|
||||
// mode.routeName
|
||||
|
||||
@ -19,7 +19,11 @@ const bakedInRoutes = [
|
||||
},
|
||||
{
|
||||
path: '/local',
|
||||
children: Local,
|
||||
children: Local.bind(null, { modePath: '' }), // navigate to the worklist
|
||||
},
|
||||
{
|
||||
path: '/localbasic',
|
||||
children: Local.bind(null, { modePath: 'viewer' }),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user