// Only define VQC if it doesn't already exist
if (typeof VQC === "undefined") {
// Create a compatibility object
var VQC = {};
VQC.dm = VQ.dataManager();
// Parse version directly
var match = VQ.applicationName().match(/(\d+)\.(\d+)\.(\d+)/);
VQC.majorVersion = match ? parseInt(match[1], 10) : 0;
VQC.minorVersion = match ? parseInt(match[2], 10) : 0;
VQC.patchVersion = match ? parseInt(match[3], 10) : 0;
// Boolean for "major >= 6"
VQC.isVersion6OrLater = (VQC.majorVersion >= 6);
VQC.controller = function() {
if (VQC.isVersion6OrLater) {
return VQ.controller(); // new API
} else {
return VQ.controler(); // legacy API
}
};
VQC.mipController = function() {
if (VQC.isVersion6OrLater) {
return VQ.mipController(); // new API
} else {
return VQ.mipControler(); // legacy API
}
};
VQC.storeData = function(dcmRep, id) {
var childCount = dm.count(id);
var format;
if (VQC.isVersion6OrLater) {
// Version 6+: use MFModule or MFGroup
format = (childCount > 1)
? VQ.DICOMImageFormat.MFGroup
: VQ.DICOMImageFormat.MFModule;
} else {
// Legacy: use 0 or 1
format = (childCount > 1) ? 1 : 0;
}
// Call the real storeData
//J2K compression is not available on this API, consider using it.
//If you use it put a the old versions in the legacy else statement
return VQ.storeData(dcmRep, id, format);
};
VQC.setDescRepository = function(id, value){
if (VQC.isVersion6OrLater) {
VQC.dm.setDesc(id, "IPACS_Repository", value, "VivoQuant");
} else {
VQC.dm.setDesc(id, "__repository", value);
}
}
VQC.setDescProject = function(id, value){
if (VQC.isVersion6OrLater) {
VQC.dm.setDesc(id, "IPACS_Project", value, "VivoQuant");
} else {
VQC.dm.setDesc(id,"__project",value);
}
}
VQC.getDescRepository = function(id){
if (VQC.isVersion6OrLater) {
return VQC.dm.getDesc(id, "IPACS_Repository", "VivoQuant");
} else {
return VQC.dm.getDesc(id, "__repository");
}
}
VQC.getDescProject = function(id){
if (VQC.isVersion6OrLater) {
return VQC.dm.getDesc(id, "IPACS_Project","VivoQuant");
} else {
return VQC.dm.getDesc(id,"__project");
}
}
}