diff --git a/dicoogle/src/main/java/pt/ua/dicoogle/server/ControlServices.java b/dicoogle/src/main/java/pt/ua/dicoogle/server/ControlServices.java index 5077f56a3..ba4fcf624 100755 --- a/dicoogle/src/main/java/pt/ua/dicoogle/server/ControlServices.java +++ b/dicoogle/src/main/java/pt/ua/dicoogle/server/ControlServices.java @@ -20,7 +20,10 @@ import java.io.IOException; import java.util.List; + +import org.dcm4che2.data.Tag; import org.slf4j.Logger; +import pt.ua.dicoogle.sdk.datastructs.SOPClass; import pt.ua.dicoogle.sdk.settings.server.ServerSettings; import pt.ua.dicoogle.server.queryretrieve.QueryRetrieve; @@ -128,8 +131,14 @@ public int startStorage() throws IOException { ServerSettings settings = ServerSettingsManager.getSettings(); + SOPList list = SOPList.getInstance(); - //list.setDefaultSettings(); + settings.getDicomServicesSettings().getSOPClasses().forEach( + sopClass -> sopClass.getTransferSyntaxes() + .forEach(ts -> list.updateTSFieldByTsUID( + sopClass.getUID(), ts, true)) + ); + int i; diff --git a/dicoogle/src/main/java/pt/ua/dicoogle/server/SOPList.java b/dicoogle/src/main/java/pt/ua/dicoogle/server/SOPList.java index 3055f2f7e..cb41715bd 100755 --- a/dicoogle/src/main/java/pt/ua/dicoogle/server/SOPList.java +++ b/dicoogle/src/main/java/pt/ua/dicoogle/server/SOPList.java @@ -209,7 +209,14 @@ public synchronized int updateTS(String UID, boolean [] p, boolean a) { TS.setAccepted(a); } return 0; - } + } + + + public int updateTSFieldByTsUID(String sopUID, String tsUID, boolean value){ + return updateTSField(sopUID, TransfersStorage.globalTransferUIDsMap.get(tsUID), value); + } + + /** * Updates a given SOP Class accepted Tranfer Syntaxes * @param UID SOP Class @@ -232,6 +239,8 @@ public synchronized int updateTSField(String UID, String name, boolean value) { } if(TS !=null && index != -1) { + TS.setAccepted(value); + //TS.setDefaultSettings(); if(TS.setTS(value, index) != 0) { return -1; diff --git a/dicoogle/src/main/java/pt/ua/dicoogle/server/TransfersStorage.java b/dicoogle/src/main/java/pt/ua/dicoogle/server/TransfersStorage.java index 0121d850c..6ceea3908 100755 --- a/dicoogle/src/main/java/pt/ua/dicoogle/server/TransfersStorage.java +++ b/dicoogle/src/main/java/pt/ua/dicoogle/server/TransfersStorage.java @@ -47,6 +47,7 @@ public class TransfersStorage { */ public static final Map globalTransferMap; + public static final Map globalTransferUIDsMap; static { Map aMap = new HashMap<>(); aMap.put(0, "ImplicitVRLittleEndian"); @@ -64,6 +65,24 @@ public class TransfersStorage { aMap.put(12, "RLELossless"); aMap.put(13, "MPEG2"); globalTransferMap = Collections.unmodifiableMap(aMap); + Map uidsNameMapping = new HashMap<>(); + + uidsNameMapping.put(UID.ImplicitVRLittleEndian, "ImplicitVRLittleEndian"); + uidsNameMapping.put(UID.ExplicitVRLittleEndian, "ExplicitVRLittleEndian"); + uidsNameMapping.put(UID.DeflatedExplicitVRLittleEndian, "DeflatedExplicitVRLittleEndian"); + uidsNameMapping.put(UID.ExplicitVRBigEndian, "ExplicitVRBigEndian"); + uidsNameMapping.put(UID.JPEGLossless, "JPEGLossless"); + uidsNameMapping.put(UID.JPEGLSLossless, "JPEGLSLossless"); + uidsNameMapping.put(UID.JPEGLosslessNonHierarchical14, "JPEGLosslessNonHierarchical14"); + uidsNameMapping.put(UID.JPEG2000LosslessOnly, "JPEG2000LosslessOnly"); + uidsNameMapping.put(UID.JPEGBaseline1, "JPEGBaseline1"); + uidsNameMapping.put(UID.JPEGExtended24, "JPEGExtended24"); + uidsNameMapping.put(UID.JPEGLSLossyNearLossless, "JPEGLSLossyNearLossless"); + uidsNameMapping.put(UID.JPEG2000, "JPEG2000"); + uidsNameMapping.put(UID.RLELossless, "RLELossless"); + uidsNameMapping.put(UID.MPEG2, "MPEG2"); + globalTransferUIDsMap = Collections.unmodifiableMap(uidsNameMapping); + } public TransfersStorage() {