Skip to content

Commit

Permalink
Merge pull request #359 from BMDSoftware/bug/cstoresop
Browse files Browse the repository at this point in the history
 Fix problem related with set SOP Class UID during bootstrap of DicomStorage
  • Loading branch information
bastiao authored May 28, 2018
2 parents aa7d6f2 + 29ab5c0 commit d4fb840
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
11 changes: 10 additions & 1 deletion dicoogle/src/main/java/pt/ua/dicoogle/server/SOPList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
19 changes: 19 additions & 0 deletions dicoogle/src/main/java/pt/ua/dicoogle/server/TransfersStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class TransfersStorage {
*/

public static final Map<Integer, String> globalTransferMap;
public static final Map<String, String> globalTransferUIDsMap;
static {
Map<Integer, String> aMap = new HashMap<>();
aMap.put(0, "ImplicitVRLittleEndian");
Expand All @@ -64,6 +65,24 @@ public class TransfersStorage {
aMap.put(12, "RLELossless");
aMap.put(13, "MPEG2");
globalTransferMap = Collections.unmodifiableMap(aMap);
Map<String, String> 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()
{
Expand Down

0 comments on commit d4fb840

Please sign in to comment.