Commits

Rick Herrick committed d46d181

XNAT-2197, XNAT-2815: Added in filtering of PET tracer in cases where a session label is already specified.

  • Participants
  • Parent commits 93f73ad

Comments (0)

Files changed (1)

src/main/java/org/nrg/upload/ui/AssignSessionVariablesPage.java

 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.regex.Pattern;
 
 import static org.nrg.upload.data.SessionVariableNames.*;
 
                 // tracer is special and PET-only
                 final String field = v.getExportField();
                 if (!Strings.isNullOrEmpty(field) && !TRACER_PATH.equals(field)) {
-                    logger.error("script variable {} has unexpected export path {}, replacing with "
-                            + TRACER, v, field);
+                    logger.error("script variable {} has unexpected export path {}, replacing with " + TRACER, v, field);
                 }
                 i.remove();
                 tracer = v;  // Process this later
         }
 
         // If this is a PET study, allow the user to specify a tracer.
-        logger.trace("checking for PET in modalities {}", modalities);
-        final boolean hasPET = modalities.contains("PET") || modalities.contains("PT");
-        if (hasPET) {
+        final boolean hasPETNoLabel = !predefs.containsKey(SESSION_LABEL) && (modalities.contains("PET") || modalities.contains("PT"));
+        if (hasPETNoLabel) {
+            logger.trace("Found PET in session without predefined label");
             final Set<String> tracers = Sets.newLinkedHashSet();
             try {
                 tracers.addAll(project.getPETTracers());
         // that results in a session label not already defined in this project.
         final IndexedDependentSessionVariable defaultSessionLabel;
 
-        if (hasPET) {
+        if (hasPETNoLabel) {
             // use the tracer instead of the modality string for PET
             assert null != tracer;
             logger.trace("building indexed tracer default session label from {}", tracer);
             vSession.addValidator(LabelValueValidator.getInstance());
         }
 
-        if (hasPET) {
+        if (hasPETNoLabel) {
             assert null != tracer;
             if (!vars.contains(tracer)) {
                 vars.addFirst(tracer);