|
1 | 1 | import axios from "axios";
|
2 |
| -import { Patient, Study, Series, PatientPayload, OrthancResponse, StudyPayload, SeriesPayload } from '../utils/types'; |
| 2 | +import { Patient, Study, Series, PatientPayload, OrthancResponse, StudyPayload, SeriesPayload, Instances } from '../utils/types'; |
3 | 3 |
|
4 | 4 | export const getOrthancSystem = (): Promise<unknown> => {
|
5 | 5 | return axios.get("/api/system").then(response => response.data)
|
@@ -178,6 +178,39 @@ export const getSeriesOfStudy = (studyId: string): Promise<Series[]> => {
|
178 | 178 | });
|
179 | 179 | };
|
180 | 180 |
|
| 181 | +export const getInstancesOfSeries = (seriesId: string) => { |
| 182 | + return axios.get(`/api/series/${seriesId}/instances`) |
| 183 | + .then((response: any): Instances[] => { |
| 184 | + const mappedData = response.data.map((data: any) : Instances => ({ |
| 185 | + fileSize: data.FileSize, |
| 186 | + fileUuid: data.FileUuid, |
| 187 | + id: data.ID, |
| 188 | + indexInSeries: data.IndexInSeries, |
| 189 | + labels: data.Labels, |
| 190 | + mainDicomTags: { |
| 191 | + acquisitionNumber: data.MainDicomTags.AcquisitionNumber, |
| 192 | + imageComments: data.MainDicomTags.ImageComments, |
| 193 | + imageOrientationPatient: data.MainDicomTags.ImageOrientationPatient, |
| 194 | + imagePositionPatient: data.MainDicomTags.ImagePositionPatient, |
| 195 | + instanceCreationDate: data.MainDicomTags.InstanceCreationDate, |
| 196 | + instanceCreationTime: data.MainDicomTags.InstanceCreationTime, |
| 197 | + instanceNumber: data.MainDicomTags.InstanceNumber, |
| 198 | + sopInstanceUID: data.MainDicomTags.SopInstanceUID |
| 199 | + }, |
| 200 | + parentSeries: data.ParentSeries, |
| 201 | + type: data.Type |
| 202 | + })); |
| 203 | + return mappedData; |
| 204 | + }).catch((error: any) => { |
| 205 | + if (error.response) { |
| 206 | + console.error("Error response:", error.response); |
| 207 | + throw error.response; |
| 208 | + } |
| 209 | + console.error("Error:", error); |
| 210 | + throw error; |
| 211 | + }); |
| 212 | +} |
| 213 | + |
181 | 214 |
|
182 | 215 | export const modifyPatient = (patientId: string, patient: PatientPayload): Promise<OrthancResponse> => {
|
183 | 216 | const patientPayloadUpdate = {
|
@@ -244,7 +277,7 @@ export const modifySeries = (seriesId: string, series: SeriesPayload): Promise<O
|
244 | 277 | const seriesPayloadUpdate = {
|
245 | 278 | Replace: {
|
246 | 279 | ImageOrientationPatient: series.replace.imageOrientationPatient,
|
247 |
| - Manufacturer : series.replace.manufacturer, |
| 280 | + Manufacturer: series.replace.manufacturer, |
248 | 281 | Modality: series.replace.modality,
|
249 | 282 | OperatorsName: series.replace.operatorsName,
|
250 | 283 | ProtocolName: series.replace.protocolName,
|
@@ -277,7 +310,7 @@ export const modifySeries = (seriesId: string, series: SeriesPayload): Promise<O
|
277 | 310 | throw error;
|
278 | 311 | });
|
279 | 312 | }
|
280 |
| - |
| 313 | + |
281 | 314 | export const getPatient = (patientId: string): Promise<Patient> => {
|
282 | 315 | return axios.get("/api/patients/" + patientId)
|
283 | 316 | .then((response): Patient => {
|
|
0 commit comments