Skip to content

Commit 2a698a1

Browse files
committed
no label/thumbnail, safer
1 parent 6b8a5fe commit 2a698a1

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

common/DicomWebMods.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,31 @@ function DicomWebMods() {
5959
const instance_results = instance_data.map(x => {
6060
try {
6161
return {
62-
height: x["00480007"]["Value"][0],
63-
width: x["00480006"]["Value"][0],
64-
tile_size: x["00280010"]["Value"][0], // Assuming square tiles
65-
url: x["url"].split("/metadata")[0]
62+
height: x["00480007"]?.["Value"]?.[0] ?? null,
63+
width: x["00480006"]?.["Value"]?.[0] ?? null,
64+
tile_size: x["00280010"]?.["Value"]?.[0] ?? null,
65+
url: x["url"]?.split("/metadata")[0] ?? "",
66+
type: x["00080008"]?.["Value"] ?? [],
6667
};
6768
} catch (error) {
6869
console.error("Error processing instance metadata:", error);
6970
return null;
7071
}
71-
}).filter(item => item !== null);
72+
}).filter(x=>{
73+
if (x == null){
74+
return false;
75+
}
76+
let types = x['type']
77+
for (let i=0; i< types.length; i++){
78+
let v = types[i].toUpperCase();
79+
if (v.indexOf("LABEL") !== -1 ||
80+
v.indexOf("THUMBNAIL") !== -1 ||
81+
v.indexOf("OVERVIEW") !== -1) {
82+
return false;
83+
}
84+
}
85+
return true;
86+
});
7287

7388
// Sort instance_results by width in ascending order
7489
instance_results.sort((a, b) => a.width - b.width);

0 commit comments

Comments
 (0)