Skip to content

Commit

Permalink
Fix #39: new configs for series modification
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Nov 28, 2023
1 parent 21a103d commit e91a0b9
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 93 deletions.
7 changes: 6 additions & 1 deletion Plugin/DefaultConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,13 @@
// "modify-keep-uids" is equivalent to KeepSource=True and Keep=["StudyInstanceUID", "SeriesInstanceUID", "SOPInstanceUID"]
// "modify-new-uids" is equivalent to KeepSource=False
// "duplicate" is equivalent to KeepSource=True
// "AllowedModes" and "DefaultMode" apply to studies modification
"AllowedModes": ["modify-new-uids", "modify-keep-uids", "duplicate"],
"DefaultMode": "modify-new-uids"
"DefaultMode": "modify-new-uids",

// same configurations for Series (introduced in 1.2.0)
"SeriesAllowedModes": ["modify-new-uids", "modify-keep-uids", "duplicate"],
"SeriesDefaultMode": "modify-new-uids"

},

Expand Down
115 changes: 50 additions & 65 deletions WebApplication/src/components/ModifyModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ export default {
this.jobProgressFailed = 0;
this.jobProgressRemaining = 100;
this.modificationMode = this.uiOptions.Modifications.DefaultMode;
if (this.resourceLevel == 'study') {
this.modificationMode = this.uiOptions.Modifications.DefaultMode;
} else {
this.modificationMode = this.uiOptions.Modifications.SeriesDefaultMode;
}
if (this.isAnonymization) {
if (this.resourceLevel == 'study') {
Expand Down Expand Up @@ -320,9 +324,9 @@ export default {
const jobId = await api.modifyResource({
resourceLevel: 'series',
orthancId: this.orthancId,
replaceTags: this.tags,
keepTags: ['SeriesInstanceUID', 'SOPInstanceUID'],
keepSource: true // keep the source since the orthanc id won't change !
replaceTags: this.modifiedTags,
keepTags: (this.keepDicomUids ? ['SeriesInstanceUID', 'SOPInstanceUID'] : []),
keepSource: this.keepSource,
});
console.log("modify-series-tags: created job ", jobId);
this.startMonitoringJob(jobId);
Expand Down Expand Up @@ -422,14 +426,7 @@ export default {
if (this.isRemovedTag(tag)) {
return true;
}
if (this.resourceLevel == 'series') {
if (this.action == 'modify-series-tags' && tag == 'SeriesInstanceUID') {
return true;
} else {
return false;
}
}
else if (this.isDicomUid(tag)) {
if (this.isDicomUid(tag)) {
return this.keepDicomUids;
} else {
return false;
Expand All @@ -454,7 +451,7 @@ export default {
return ['StudyInstanceUID', 'SeriesInstanceUID', 'SOPInstanceUID'].indexOf(tag) != -1;
},
isAutogeneratedDicomUid(tag) {
if (this.resourceLevel == 'series') {
if (this.resourceLevel == 'series' && this.action == 'attach-series-to-existing-study') {
return false;
}
if (this.isDicomUid(tag)) {
Expand Down Expand Up @@ -504,10 +501,23 @@ export default {
console.log("insert tag " + tag, this.tags, this.removedTags);
},
isModeAllowed(mode) {
if (this.resourceLevel == 'series') {
if (this.resourceLevel == 'series' && this.uiOptions.Modifications.SeriesAllowedModes.indexOf(mode) != -1) {
return true;
} else if (this.resourceLevel == 'study' && this.uiOptions.Modifications.AllowedModes.indexOf(mode) != -1) {
return true;
}
return false;
},
canSelectModes() {
if (this.isAnonymization) {
return false;
}
return this.uiOptions.Modifications.AllowedModes.indexOf(mode) != -1;
if (this.resourceLevel == 'series' && this.uiOptions.Modifications.SeriesAllowedModes.length > 1) {
return this.action == 'modify-series-tags';
} else if (this.resourceLevel == 'study' && this.uiOptions.Modifications.AllowedModes.length > 1) {
return true;
}
return false;
}
},
Expand Down Expand Up @@ -593,6 +603,27 @@ export default {
return 'modify.modify_button_title';
}
},
modifyModeNewUidText() {
if (this.resourceLevel == 'series') {
return 'modify.modify_series_mode_new_uids_html'
} else {
return 'modify.modify_study_mode_new_uids_html'
}
},
modifyModeKeepUidText() {
if (this.resourceLevel == 'series') {
return 'modify.modify_series_mode_keep_uids_html'
} else {
return 'modify.modify_study_mode_keep_uids_html'
}
},
modifyModeDuplicateText() {
if (this.resourceLevel == 'series') {
return 'modify.modify_series_mode_duplicate_html'
} else {
return 'modify.modify_study_mode_duplicate_html'
}
},
modifyButtonEnabled() {
if (this.isAnonymization) {
return true;
Expand Down Expand Up @@ -724,46 +755,6 @@ export default {
</button>
</div>
</div>

<div v-if="isAutogeneratedDicomUid(key)" class="col-md-1">
</div>

<!-- <div v-if="isFrozenTag(key)" class="col-md-6">
<input v-if="true" type="text" class="form-control" disabled :class="{ 'striked-through': !isDicomUid(key) }"
v-model="originalTags[key]" />
</div>
<div v-if="isFrozenTag(key)" class="col-md-1">
<div class="d-flex flex-row-reverse">
<button v-if="isRemovable(key) && !isRemovedTag(key)" class="btn-small"
type="button" data-bs-toggle="tooltip" :title="$t('modify.remove_tag_tooltip')"
@click="toggleRemovedTag(key)">
<i v-if="!isRemovedTag(key)" class="bi-trash"></i>
</button>
<button v-if="isRemovable(key) && isRemovedTag(key)" class="btn-small" type="button"
data-bs-toggle="tooltip" :title="$t('modify.remove_tag_undo_tooltip')"
@click="toggleRemovedTag(key)">
<i v-if="isRemovedTag(key)" class="bi-recycle"></i>
</button>
</div>
</div>
<div v-if="!isFrozenTag(key) && isEditableTag(key)" class="col-md-6">
<input v-if="true" type="text" class="form-control" v-model="tags[key]" />
</div>
<div v-if="!isFrozenTag(key) && isEditableTag(key)" class="col-md-1">
<div class="d-flex flex-row-reverse">
<button v-if="isRemovable(key) && !isRemovedTag(key)" class="btn-small"
type="button" data-bs-toggle="tooltip" :title="$t('modify.remove_tag_tooltip')"
@click="toggleRemovedTag(key)">
<i v-if="!isRemovedTag(key)" class="bi-trash"></i>
</button>
<button v-if="isRemovable(key) && isRemovedTag(key)" class="btn-small" type="button"
data-bs-toggle="tooltip" :title="$t('modify.remove_tag_undo_tooltip')"
@click="toggleRemovedTag(key)">
<i v-if="isRemovedTag(key)" class="bi-recycle"></i>
</button>
</div>
</div> -->

</div>
<div v-if="action == 'modify-any-tags-in-one-study'" class="row pt-3">
<div class="col-md-8"></div>
Expand All @@ -781,26 +772,26 @@ export default {
</div>
</div>
</div>
<div v-if="!isAnonymization" class="row pt-3">
<div v-if="canSelectModes()" class="row pt-3">
<div v-if="isModeAllowed('modify-new-uids')" class="form-check">
<input class="form-check-input" type="radio" name="modificationMode" id="modifyNewUids"
value="modify-new-uids" v-model="modificationMode">
<label class="form-check-label" for="modifyNewUids"
v-html="$t('modify.modify_mode_new_uids_html')">
v-html="$t(modifyModeNewUidText)">
</label>
</div>
<div v-if="isModeAllowed('modify-keep-uids')" class="form-check">
<input class="form-check-input" type="radio" name="modificationMode" id="modifyKeepUids"
value="modify-keep-uids" v-model="modificationMode">
<label class="form-check-label" for="modifyKeepUids"
v-html="$t('modify.modify_mode_keep_uids_html')">
v-html="$t(modifyModeKeepUidText)">
</label>
</div>
<div v-if="isModeAllowed('duplicate')" class="form-check">
<input class="form-check-input" type="radio" name="modificationMode"
id="modifyDuplicate" value="duplicate" v-model="modificationMode">
<label class="form-check-label" for="modifyDuplicate"
v-html="$t('modify.modify_mode_duplicate_html')">
v-html="$t(modifyModeDuplicateText)">
</label>
</div>
</div>
Expand All @@ -815,12 +806,6 @@ export default {
$t(modifyButtonTitle)
}}</button>
</div>
<!-- <div v-if="step == 'tags' && isAnonymization" class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ $t("cancel") }}</button>
<button type="button" class="btn btn-primary" @click="modify()">{{
$t("modify.anonymize_button_title")
}}</button>
</div> -->

<!-- ------------------------------------------ step 'warning' or 'error' --------------------------------------------------->
<div v-if="step == 'warning' || step == 'error'" class="modal-body">
Expand Down
6 changes: 3 additions & 3 deletions WebApplication/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@
"error_modify_unexpected_error_html": "Unerwarteter Fehler während der Änderung, überprüfen Sie die Orthanc-Protokolle",
"insert_tag": "DICOM-Tag einfügen",
"job_in_progress": "Änderung wird verarbeitet",
"modify_mode_new_uids_html": "Originalstudie verändern. <small>(generiert neue DICOM-UIDs)</small>",
"modify_mode_keep_uids_html": "Originalstudie verändern. <small>(behalten die originalen DICOM-UIDs)</small>",
"modify_mode_duplicate_html": "Erstellen Sie eine Kopie der Originalstudie mit Ihren Änderungen. <small>(generiert neue DICOM-UIDs und behält die Originalstudie)</small>",
"modify_study_mode_new_uids_html": "Originalstudie verändern. <small>(generiert neue DICOM-UIDs)</small>",
"modify_study_mode_keep_uids_html": "Originalstudie verändern. <small>(behalten die originalen DICOM-UIDs)</small>",
"modify_study_mode_duplicate_html": "Erstellen Sie eine Kopie der Originalstudie mit Ihren Änderungen. <small>(generiert neue DICOM-UIDs und behält die Originalstudie)</small>",
"modify_button_title": "Ändern",
"modify_modal_title": "Ändern",
"remove_tag_tooltip": "Tag entfernen",
Expand Down
9 changes: 6 additions & 3 deletions WebApplication/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@
"error_modify_unexpected_error_html": "Unexpected error during modification, check Orthanc logs",
"insert_tag": "Insert a DICOM Tag",
"job_in_progress": "Modification is being processed",
"modify_mode_new_uids_html": "Modify the original study. <small>(generating new DICOM UIDs)</small>",
"modify_mode_keep_uids_html": "Modify the original study. <small>(keeping the original DICOM UIDs)</small>",
"modify_mode_duplicate_html": "Create a modified copy of the original study. <small>(generating new DICOM UIDs and keeping the original study)</small>",
"modify_series_mode_new_uids_html": "Modify the original series. <small>(generating new DICOM UIDs)</small>",
"modify_series_mode_keep_uids_html": "Modify the original series. <small>(keeping the original DICOM UIDs)</small>",
"modify_series_mode_duplicate_html": "Create a modified copy of the original series. <small>(generating new DICOM UIDs and keeping the original series)</small>",
"modify_study_mode_new_uids_html": "Modify the original study. <small>(generating new DICOM UIDs)</small>",
"modify_study_mode_keep_uids_html": "Modify the original study. <small>(keeping the original DICOM UIDs)</small>",
"modify_study_mode_duplicate_html": "Create a modified copy of the original study. <small>(generating new DICOM UIDs and keeping the original study)</small>",
"modify_button_title": "Modify",
"modify_modal_title": "Modify",
"remove_tag_tooltip": "Remove tag",
Expand Down
6 changes: 3 additions & 3 deletions WebApplication/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
"error_modify_unexpected_error_html": "Error inesperado durante la modificación, verifique los registros de Orthanc",
"insert_tag": "Insertar una etiqueta DICOM",
"job_in_progress": "Se está procesando la modificación",
"modify_mode_new_uids_html": "Modificar el estudio original. <small>(generando nuevos DICOM UIDs)</small>",
"modify_mode_keep_uids_html": "Modificar el estudio original. <small>(manteniendo los DICOM UIDs originales)</small>",
"modify_mode_duplicate_html": "Crear una copia modificada del estudio original. <small>(generando nuevos DICOM UIDs y manteniendo el estudio original)</small>",
"modify_study_mode_new_uids_html": "Modificar el estudio original. <small>(generando nuevos DICOM UIDs)</small>",
"modify_study_mode_keep_uids_html": "Modificar el estudio original. <small>(manteniendo los DICOM UIDs originales)</small>",
"modify_study_mode_duplicate_html": "Crear una copia modificada del estudio original. <small>(generando nuevos DICOM UIDs y manteniendo el estudio original)</small>",
"modify_button_title": "Modificar",
"modify_modal_title": "Modificar",
"remove_tag_tooltip": "Eliminar etiqueta",
Expand Down
9 changes: 6 additions & 3 deletions WebApplication/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@
"error_modify_unexpected_error_html": "Erreur inattendue lors de la modification, vérifiez les logs d'Orthanc",
"insert_tag": "Insérer un tag DICOM",
"job_in_progress": "La modification est en cours de traitement",
"modify_mode_new_uids_html": "Modifier l'examen original. <small>(en générant de nouveaux UID DICOM)</small>",
"modify_mode_keep_uids_html": "Modifier l'examen original. <small>(en conservant les UID DICOM d'origine)</small>",
"modify_mode_duplicate_html": "Créer une copie modifiée de l'examen original. <small>(en générant de nouveaux UID DICOM et en conservant l'examen original)</small>",
"modify_series_mode_new_uids_html": "Modifier la série originale. <small>(en générant de nouveaux UID DICOM)</small>",
"modify_series_mode_keep_uids_html": "Modifier la série originale. <small>(en conservant les UID DICOM d'origine)</small>",
"modify_series_mode_duplicate_html": "Créer une copie modifiée de la série originale. <small>(en générant de nouveaux UID DICOM et en conservant la série originale)</small>",
"modify_study_mode_new_uids_html": "Modifier l'examen original. <small>(en générant de nouveaux UID DICOM)</small>",
"modify_study_mode_keep_uids_html": "Modifier l'examen original. <small>(en conservant les UID DICOM d'origine)</small>",
"modify_study_mode_duplicate_html": "Créer une copie modifiée de l'examen original. <small>(en générant de nouveaux UID DICOM et en conservant l'examen original)</small>",
"modify_button_title": "Modifier",
"modify_modal_title": "Modifier",
"remove_tag_tooltip": "Supprimer le tag",
Expand Down
6 changes: 3 additions & 3 deletions WebApplication/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
"error_modify_unexpected_error_html": "Errore inaspettato durante la modifica, verifica i log di Orthanc",
"insert_tag": "Inserisci un'etichetta DICOM",
"job_in_progress": "La modifica è in fase di elaborazione",
"modify_mode_new_uids_html": "Modifica lo studio originale. <small>(generazione di un nuovo DICOM UIDs)</small>",
"modify_mode_keep_uids_html": "Modifica lo studio originale. <small>(mantenendo l'originale DICOM UIDs)</small>",
"modify_mode_duplicate_html": "Creare una copia modificata dello studio originale. <small>(generazione di un nuovo DICOM UIDs e mantenendo lo studio originale)</small>",
"modify_study_mode_new_uids_html": "Modifica lo studio originale. <small>(generazione di un nuovo DICOM UIDs)</small>",
"modify_study_mode_keep_uids_html": "Modifica lo studio originale. <small>(mantenendo l'originale DICOM UIDs)</small>",
"modify_study_mode_duplicate_html": "Creare una copia modificata dello studio originale. <small>(generazione di un nuovo DICOM UIDs e mantenendo lo studio originale)</small>",
"modify_button_title": "Modifica",
"modify_modal_title": "Modifica",
"remove_tag_tooltip": "Rimuovi etichetta",
Expand Down
Loading

0 comments on commit e91a0b9

Please sign in to comment.