4940649406
4940749407 const studyInstanceUID = metadata['0020000D']['Value'][0];
4940849408 const seriesInstanceUID = metadata['0020000E']['Value'][0];
49409- const sopInstanceUID = metadata['00080018']['Value'][0];
4941049409 const rows = metadata['00280010']['Value'][0];
4941149410 const columns = metadata['00280011']['Value'][0];
4941249411 const totalPixelMatrixColumns = metadata['00480006']['Value'][0];
@@ -49433,20 +49432,26 @@
4943349432
4943449433 let tilesPerRow = Math.ceil(totalPixelMatrixColumns / columns);
4943549434 const frameMapping = {};
49435+ // We may update the SOPInstanceUID when reassembling concatentations
49436+ let sopInstanceUID = metadata['00080018']['Value'][0];
49437+ let sopInstanceUIDOfConcatenationSource = null;
49438+ let frameOffsetNumber = 0;
49439+ if ('00209161' in metadata) {
49440+ sopInstanceUIDOfConcatenationSource = metadata['00209161']['Value'][0];
49441+ frameOffsetNumber = Number(metadata['00209228']['Value'][0]);
49442+ }
4943649443 if (dimensionOrganizationType === 'TILED_FULL') {
49437- let frameOffsetNumber = 0;
49438- if ('00209161' in metadata) {
49439- frameOffsetNumber = Number(metadata['00209228']['Value'][0]);
49440- }
4944149444 let offset = frameOffsetNumber + 1;
4944249445 let limit = frameOffsetNumber + numberOfFrames;
4944349446 for (let j = offset; j <= limit; j++) {
49444- let rowIndex = Math.ceil(j / tilesPerRow);
49445- let rowFraction = 1 - (rowIndex - (j / tilesPerRow));
49446- let colIndex = Math.ceil(totalPixelMatrixColumns * rowFraction / columns);
49447+ let rowFraction = j / tilesPerRow;
49448+ let rowIndex = Math.ceil(rowFraction);
49449+ let colIndex = j - (rowIndex * tilesPerRow) + tilesPerRow;
49450+ // let colFraction = 1 - (rowIndex - rowFraction);
49451+ // let colIndex = Math.ceil((totalPixelMatrixColumns * colFraction) / columns);
4944749452 let index = rowIndex + '-' + colIndex;
4944849453 let frameNumber = j - offset + 1;
49449- frameMapping[index] = frameNumber;
49454+ frameMapping[index] = `${sopInstanceUID}/frames/${ frameNumber}` ;
4945049455 }
4945149456 } else {
4945249457 const perFrameFunctionalGroupsSequence = metadata['52009230']['Value'];
@@ -49458,10 +49463,14 @@
4945849463 let colIndex = Math.ceil(columnPositionInTotalPixelMatrix / rows);
4945949464 let index = rowIndex + '-' + colIndex;
4946049465 let frameNumber = j + 1;
49461- frameMapping[index] = frameNumber;
49466+ frameMapping[index] = `${sopInstanceUID}/frames/${ frameNumber}` ;
4946249467 }
4946349468 }
4946449469
49470+ if (sopInstanceUIDOfConcatenationSource) {
49471+ sopInstanceUID = sopInstanceUIDOfConcatenationSource;
49472+ }
49473+
4946549474 return({
4946649475 studyInstanceUID,
4946749476 seriesInstanceUID,
5019850207 const type = geometry.getType();
5019950208 if (type === 'Point') {
5020050209 let coordinates = geometry.getCoordinates();
50201- return _geometryCoordinates2scoordCoordinates(coordinates);
50210+ coordinates = _geometryCoordinates2scoordCoordinates(coordinates);
5020250211 return new Point$1(coordinates);
5020350212 } else if (type === 'Polygon') {
5020450213 /*
5033150340 for (let i = 0; i < metadata.length; i++) {
5033250341 const cols = metadata[i].totalPixelMatrixColumns;
5033350342 const rows = metadata[i].totalPixelMatrixRows;
50334- const paths = metadata[i].paths ;
50343+ const mapping = metadata[i].frameMapping ;
5033550344 /*
5033650345 * Instances may be broken down into multiple concatentation parts.
5033750346 * Therefore, we have to re-assemble instance metadata.
5034850357 }
5034950358 }
5035050359 if (alreadyExists) {
50351- /*
50352- * Update "paths" with information obtained from current
50353- * concatentation part.
50354- */
50355- Object.assign(this[_pyramid][index].paths, paths);
50360+ // Update with information obtained from current concatentation part.
50361+ Object.assign(this[_pyramid][index].frameMapping, mapping);
5035650362 } else {
5035750363 this[_pyramid].push(metadata[i]);
5035850364 }
5036750373 return 0;
5036850374 }
5036950375 });
50376+ console.log(this[_pyramid]);
5037050377
5037150378 /*
5037250379 * Collect relevant information from DICOM metadata for each pyramid
@@ -50435,16 +50442,15 @@
5043550442 */
5043650443 let x = -(tileCoord[2] + 1) + 1;
5043750444 let index = x + "-" + y;
50438- let frameNumber = pyramid[z].frameMapping[index];
50439- if (frameNumber === undefined) {
50445+ let path = pyramid[z].frameMapping[index];
50446+ if (path === undefined) {
5044050447 console.warn("tile " + index + " not found at level " + z);
5044150448 return(null);
5044250449 }
5044350450 let url = options.client.baseUrl +
5044450451 "/studies/" + pyramid[z].studyInstanceUID +
5044550452 "/series/" + pyramid[z].seriesInstanceUID +
50446- '/instances/' + pyramid[z].sopInstanceUID +
50447- '/frames/' + frameNumber;
50453+ '/instances/' + path;
5044850454 return(url);
5044950455 }
5045050456
0 commit comments