Initial commit from prod-batam
This commit is contained in:
22
platform/app/src/routes/Local/filesToStudies.js
Normal file
22
platform/app/src/routes/Local/filesToStudies.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import FileLoaderService from './fileLoaderService';
|
||||
import { DicomMetadataStore } from '@ohif/core';
|
||||
|
||||
const processFile = async file => {
|
||||
try {
|
||||
const fileLoaderService = new FileLoaderService(file);
|
||||
const imageId = fileLoaderService.addFile(file);
|
||||
const image = await fileLoaderService.loadFile(file, imageId);
|
||||
const dicomJSONDataset = await fileLoaderService.getDataset(image, imageId);
|
||||
|
||||
DicomMetadataStore.addInstance(dicomJSONDataset);
|
||||
} catch (error) {
|
||||
console.log(error.name, ':Error when trying to load and process local files:', error.message);
|
||||
}
|
||||
};
|
||||
|
||||
export default async function filesToStudies(files) {
|
||||
const processFilesPromises = files.map(processFile);
|
||||
await Promise.all(processFilesPromises);
|
||||
|
||||
return DicomMetadataStore.getStudyInstanceUIDs();
|
||||
}
|
||||
Reference in New Issue
Block a user