Skip to content

Commit

Permalink
Added a clickable icon to open a PDF report if the study contains one…
Browse files Browse the repository at this point in the history
… without expanding the study
  • Loading branch information
amazy committed Sep 20, 2024
1 parent 4439e89 commit bd6bea4
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
36 changes: 35 additions & 1 deletion WebApplication/src/components/StudyItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export default {
loaded: false,
expanded: false,
collapseElement: null,
selected: false
selected: false,
pdfReportsUrl: []
};
},
created() {
Expand Down Expand Up @@ -58,6 +59,15 @@ export default {
}
}
if (this.hasPdfReportIcon) {
let instances = await api.getStudyInstancesExpanded(this.study.ID, ["SOPClassUID"]);
for (let instance of instances) {
if (instance.RequestedTags.SOPClassUID == "1.2.840.10008.5.1.4.1.1.104.1") {
this.pdfReportsUrl.push(api.getInstancePdfUrl(instance.ID));
}
}
}
},
watch: {
},
Expand Down Expand Up @@ -137,6 +147,15 @@ export default {
return seriesCount;
}
},
hasPdfReportIconPlaceholder() {
return this.studiesSourceType == SourceType.LOCAL_ORTHANC && !this.hasPdfReportIcon;
},
hasPdfReportIcon() {
return this.study.RequestedTags.SOPClassesInStudy && this.study.RequestedTags.SOPClassesInStudy.indexOf("1.2.840.10008.5.1.4.1.1.104.1") != -1;
},
hasPrimaryViewerIconPlaceholder() {
return this.studiesSourceType == SourceType.LOCAL_ORTHANC && !this.hasPrimaryViewerIcon;
},
hasPrimaryViewerIcon() {
return this.studiesSourceType == SourceType.LOCAL_ORTHANC && this.primaryViewerUrl;
},
Expand Down Expand Up @@ -165,6 +184,17 @@ export default {
:tokenType="'viewer-instant-link'" :opensInNewTab="true">
</TokenLinkButton>
</td>
<td v-if="hasPrimaryViewerIconPlaceholder"></td>
<td v-if="hasPdfReportIcon" class="td-pdf-icon">
<TokenLinkButton v-for="pdfReportUrl in pdfReportsUrl" :key="pdfReportUrl"
level="study" :linkUrl="pdfReportUrl"
:resourcesOrthancId="study.ID" linkType="icon"
iconClass="bi bi-file-earmark-text"
:tokenType="'download-instant-link'" :opensInNewTab="true">
</TokenLinkButton>
</td>
<td v-if="hasPdfReportIconPlaceholder"></td>

<td v-for="columnTag in uiOptions.StudyListColumns" :key="columnTag" class="cut-text"
:class="{ 'text-center': columnTag in ['modalities', 'seriesCount', 'instancesCount', 'seriesAndInstancesCount'] }" data-bs-toggle="collapse"
v-bind:data-bs-target="'#study-details-' + this.studyId">
Expand Down Expand Up @@ -277,4 +307,8 @@ export default {
.td-viewer-icon {
padding: 0; /* to maximize click space for the icon */
}
.td-pdf-icon {
padding: 0; /* to maximize click space for the icon */
}
</style>
7 changes: 6 additions & 1 deletion WebApplication/src/components/StudyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ export default {
},
hasPrimaryViewerIcon() {
return this.sourceType == SourceType.LOCAL_ORTHANC;
},
hasPdfReportIcon() {
return this.sourceType == SourceType.LOCAL_ORTHANC;
}
},
watch: {
Expand Down Expand Up @@ -729,7 +732,8 @@ export default {
<table class="table table-responsive table-sm study-table table-borderless">
<thead class="study-table-header">
<th width="2%" scope="col" ></th>
<th v-if="hasPrimaryViewerIcon" width="3%" scope="col" ></th>
<th v-if="hasPrimaryViewerIcon" width="4%" scope="col" ></th>
<th v-if="hasPdfReportIcon" width="4%" scope="col" ></th>
<th v-for="columnTag in uiOptions.StudyListColumns" :key="columnTag" data-bs-toggle="tooltip"
v-bind:title="columnTooltip(columnTag)" v-bind:width="columnWidth(columnTag)"
class="study-table-title">{{
Expand All @@ -744,6 +748,7 @@ export default {
</button>
</th>
<th v-if="hasPrimaryViewerIcon" scope="col" ></th>
<th v-if="hasPdfReportIcon" scope="col" ></th>
<th v-for="columnTag in uiOptions.StudyListColumns" :key="columnTag">
<div v-if="columnTag == 'StudyDate'">
<Datepicker v-if="columnTag == 'StudyDate'" v-model="filterStudyDateForDatePicker"
Expand Down
7 changes: 7 additions & 0 deletions WebApplication/src/orthancApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ export default {
async getStudyInstances(orthancId) {
return (await axios.get(orthancApiUrl + "studies/" + orthancId + "/instances")).data;
},
async getStudyInstancesExpanded(orthancId, requestedTags) {
let url = orthancApiUrl + "studies/" + orthancId + "/instances?expanded";
if (requestedTags && requestedTags.length > 0) {
url += "&requestedTags=" + requestedTags.join(";")
}
return (await axios.get(url)).data;
},
async getSeriesParentStudy(orthancId) {
return (await axios.get(orthancApiUrl + "series/" + orthancId + "/study")).data;
},
Expand Down
1 change: 1 addition & 0 deletions WebApplication/src/store/modules/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const mutations = {
if (uiOptions.StudyListColumns.indexOf('seriesCount') != -1 || uiOptions.StudyListColumns.indexOf('seriesAndInstancesCount') != -1) {
state.requestedTagsForStudyList.push('NumberOfStudyRelatedSeries')
}
state.requestedTagsForStudyList.push('SOPClassesInStudy'); // to detect PDF files
},
setUserProfile(state, { profile }) {
state.userProfile = profile;
Expand Down
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Pending changes in the mainline

Changes:
- Added a clickable icon to open the primary viewer without expanding the study.
- Added a clickable icon to open a PDF report if the study contains one without expanding the study.
- new configuration "CustomFavIconPath" to customize the FavIcon
- new configuration "CustomTitle" to customize the tab/window title
- new configurations to modify the PatientName display:
Expand Down

0 comments on commit bd6bea4

Please sign in to comment.