Applied JSCS and added JSCS/jsHint config files
This commit is contained in:
1 parent
a9266608d2
commit
90a16a8059
68 files changed
+24956
-6399
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -4,14 +4,14 @@
|
||||
* @param dataSet
|
||||
* @param options
|
||||
*/
|
||||
dataSetToJsWithDictionary = function (dataSet, dictionary, options) {
|
||||
dataSetToJsWithDictionary = function(dataSet, dictionary, options) {
|
||||
if (!dataSet) {
|
||||
throw 'dataSetToJsWithDictionary: missing required parameter dataSet';
|
||||
}
|
||||
|
||||
options = options || {
|
||||
omitPrivateAttibutes: true, // true if private elements should be omitted
|
||||
maxElementLength : 128 // maximum element length to try and convert to string format
|
||||
maxElementLength: 128 // maximum element length to try and convert to string format
|
||||
};
|
||||
|
||||
// For the purpose of inserting a comma into the tag in order
|
||||
@@ -20,7 +20,7 @@ dataSetToJsWithDictionary = function (dataSet, dictionary, options) {
|
||||
|
||||
var result = {};
|
||||
|
||||
for(var tag in dataSet.elements) {
|
||||
for (var tag in dataSet.elements) {
|
||||
var element = dataSet.elements[tag];
|
||||
|
||||
// Reformat the tag from x00020010 to "0002,0010" to suit the dictionary
|
||||
@@ -43,18 +43,18 @@ dataSetToJsWithDictionary = function (dataSet, dictionary, options) {
|
||||
element.vr = tagDictionaryEntry.vr;
|
||||
}
|
||||
|
||||
|
||||
// skip this element if it a private element and our options specify that we should
|
||||
if(options.omitPrivateAttibutes === true && dicomParser.isPrivateTag(tag)) {
|
||||
if (options.omitPrivateAttibutes === true && dicomParser.isPrivateTag(tag)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(element.items) {
|
||||
if (element.items) {
|
||||
// handle sequences
|
||||
var sequenceItems = [];
|
||||
for(var i=0; i < element.items.length; i++) {
|
||||
for (var i = 0; i < element.items.length; i++) {
|
||||
sequenceItems.push(dicomParser.dataSetToJsWithDictionary(element.items[i].dataSet, dictionary, options));
|
||||
}
|
||||
|
||||
result[tagName] = sequenceItems;
|
||||
} else {
|
||||
var asString;
|
||||
@@ -63,16 +63,16 @@ dataSetToJsWithDictionary = function (dataSet, dictionary, options) {
|
||||
asString = dicomParser.explicitElementToString(dataSet, element);
|
||||
}
|
||||
|
||||
if(asString !== undefined) {
|
||||
if (asString !== undefined) {
|
||||
result[tagName] = asString;
|
||||
} else {
|
||||
result[tagName] = {
|
||||
dataOffset: element.dataOffset,
|
||||
length : element.length
|
||||
length: element.length
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
||||
@@ -1,20 +1,20 @@
|
||||
DICOMHP.imageSet = function(setNumber, category) {
|
||||
this.setNumber = setNumber;
|
||||
this.category = category;
|
||||
this.setNumber = setNumber;
|
||||
this.category = category;
|
||||
};
|
||||
|
||||
DICOMHP.imageSet.prototype.setRelativeTime = function(time) {
|
||||
this.relativeTime = time;
|
||||
this.relativeTime = time;
|
||||
};
|
||||
|
||||
DICOMHP.imageSet.prototype.setTimeUnits = function(units) {
|
||||
this.timeUnits = units;
|
||||
this.timeUnits = units;
|
||||
};
|
||||
|
||||
DICOMHP.imageSet.prototype.setPriorValue = function(priorValue) {
|
||||
this.priorValue = priorValue;
|
||||
this.priorValue = priorValue;
|
||||
};
|
||||
|
||||
DICOMHP.imageSet.prototype.retrieve = function(studyInstanceId) {
|
||||
|
||||
};
|
||||
};
|
||||
@@ -11,7 +11,7 @@ var valueRepresentationTypes = {
|
||||
* @param instance
|
||||
* @param options
|
||||
*/
|
||||
instanceDataToJsObject = function (instance, dictionary) {
|
||||
instanceDataToJsObject = function(instance, dictionary) {
|
||||
if (!instance) {
|
||||
throw 'instanceDataToJsObject: missing required parameter dataSet';
|
||||
}
|
||||
@@ -70,4 +70,4 @@ instanceDataToJsObject = function (instance, dictionary) {
|
||||
});
|
||||
console.log(result);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
@@ -84,4 +84,4 @@ DICOMHP.match = function(studyInstanceUID) {
|
||||
});
|
||||
|
||||
return matchedProtocols;*/
|
||||
};
|
||||
};
|
||||
@@ -1 +1 @@
|
||||
DICOMHP = {};
|
||||
DICOMHP = {};
|
||||
@@ -1,77 +1,78 @@
|
||||
DICOMHP.select = function(hpInstance) {
|
||||
var imageSetsSequence = hpInstance["00720020"].Value;
|
||||
if (!imageSetsSequence) {
|
||||
return [];
|
||||
}
|
||||
var matchedImageSets = [];
|
||||
imageSetsSequence.forEach(function(imageSet) {
|
||||
var selectorSequence = imageSet["00720022"].Value;
|
||||
selectorSequence.forEach(function(selector){
|
||||
var usageFlag = selector["00720024"].Value[0],
|
||||
selectorAttribute = selector["00720026"].Value[0],
|
||||
selectorAttributeVR = selector["00720050"].Value[0],
|
||||
selectorAttributeValue = null;
|
||||
var imageSetsSequence = hpInstance['00720020'].Value;
|
||||
if (!imageSetsSequence) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (selectorAttributeVR == 'SQ') {
|
||||
return;
|
||||
} else if (selectorAttributeVR == 'AT') {
|
||||
selectorAttributeValue = selector["00720060"].Value[0];
|
||||
} else if (selectorAttributeVR == 'CS') {
|
||||
selectorAttributeValue = selector["00720062"].Value[0];
|
||||
} else if (selectorAttributeVR == 'IS') {
|
||||
selectorAttributeValue = selector["00720064"].Value[0];
|
||||
} else if (selectorAttributeVR == 'LO') {
|
||||
selectorAttributeValue = selector["00720066"].Value[0];
|
||||
} else if (selectorAttributeVR == 'LT') {
|
||||
selectorAttributeValue = selector["00720068"].Value[0];
|
||||
} else if (selectorAttributeVR == 'PN') {
|
||||
selectorAttributeValue = selector["0072006A"].Value[0];
|
||||
} else if (selectorAttributeVR == 'SH') {
|
||||
selectorAttributeValue = selector["0072006C"].Value[0];
|
||||
} else if (selectorAttributeVR == 'ST') {
|
||||
selectorAttributeValue = selector["0072006E"].Value[0];
|
||||
} else if (selectorAttributeVR == 'UT') {
|
||||
selectorAttributeValue = selector["00720070"].Value[0];
|
||||
} else if (selectorAttributeVR == 'DS') {
|
||||
selectorAttributeValue = selector["00720072"].Value[0];
|
||||
} else if (selectorAttributeVR == 'FD') {
|
||||
selectorAttributeValue = selector["00720074"].Value[0];
|
||||
} else if (selectorAttributeVR == 'FL') {
|
||||
selectorAttributeValue = selector["00720076"].Value[0];
|
||||
} else if (selectorAttributeVR == 'UL') {
|
||||
selectorAttributeValue = selector["00720078"].Value[0];
|
||||
} else if (selectorAttributeVR == 'US') {
|
||||
selectorAttributeValue = selector["0072007A"].Value[0];
|
||||
} else if (selectorAttributeVR == 'SL') {
|
||||
selectorAttributeValue = selector["0072007C"].Value[0];
|
||||
} else if (selectorAttributeVR == 'SS') {
|
||||
selectorAttributeValue = selector["0072007E"].Value[0];
|
||||
}
|
||||
var matchedImageSets = [];
|
||||
imageSetsSequence.forEach(function(imageSet) {
|
||||
var selectorSequence = imageSet['00720022'].Value;
|
||||
selectorSequence.forEach(function(selector) {
|
||||
var usageFlag = selector['00720024'].Value[0],
|
||||
selectorAttribute = selector['00720026'].Value[0],
|
||||
selectorAttributeVR = selector['00720050'].Value[0],
|
||||
selectorAttributeValue = null;
|
||||
|
||||
if (selectorAttributeValue !== null) {
|
||||
if (selectorAttributeVR == 'SQ') {
|
||||
return;
|
||||
} else if (selectorAttributeVR == 'AT') {
|
||||
selectorAttributeValue = selector['00720060'].Value[0];
|
||||
} else if (selectorAttributeVR == 'CS') {
|
||||
selectorAttributeValue = selector['00720062'].Value[0];
|
||||
} else if (selectorAttributeVR == 'IS') {
|
||||
selectorAttributeValue = selector['00720064'].Value[0];
|
||||
} else if (selectorAttributeVR == 'LO') {
|
||||
selectorAttributeValue = selector['00720066'].Value[0];
|
||||
} else if (selectorAttributeVR == 'LT') {
|
||||
selectorAttributeValue = selector['00720068'].Value[0];
|
||||
} else if (selectorAttributeVR == 'PN') {
|
||||
selectorAttributeValue = selector['0072006A'].Value[0];
|
||||
} else if (selectorAttributeVR == 'SH') {
|
||||
selectorAttributeValue = selector['0072006C'].Value[0];
|
||||
} else if (selectorAttributeVR == 'ST') {
|
||||
selectorAttributeValue = selector['0072006E'].Value[0];
|
||||
} else if (selectorAttributeVR == 'UT') {
|
||||
selectorAttributeValue = selector['00720070'].Value[0];
|
||||
} else if (selectorAttributeVR == 'DS') {
|
||||
selectorAttributeValue = selector['00720072'].Value[0];
|
||||
} else if (selectorAttributeVR == 'FD') {
|
||||
selectorAttributeValue = selector['00720074'].Value[0];
|
||||
} else if (selectorAttributeVR == 'FL') {
|
||||
selectorAttributeValue = selector['00720076'].Value[0];
|
||||
} else if (selectorAttributeVR == 'UL') {
|
||||
selectorAttributeValue = selector['00720078'].Value[0];
|
||||
} else if (selectorAttributeVR == 'US') {
|
||||
selectorAttributeValue = selector['0072007A'].Value[0];
|
||||
} else if (selectorAttributeVR == 'SL') {
|
||||
selectorAttributeValue = selector['0072007C'].Value[0];
|
||||
} else if (selectorAttributeVR == 'SS') {
|
||||
selectorAttributeValue = selector['0072007E'].Value[0];
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (selectorAttributeValue !== null) {
|
||||
|
||||
var timeBasedImageSetsSequence = imageSet["00720030"].Value;
|
||||
timeBasedImageSetsSequence.forEach(function(timeImageSet){
|
||||
var setNumber = timeImageSet["00720032"].Value[0], selectorCategory = timeImageSet["00720034"].Value[0];
|
||||
}
|
||||
});
|
||||
|
||||
var mImageSet = new DICOMHP.imageSet(setNumber, selectorCategory);
|
||||
if (selectorCategory == 'RELATIVE_TIME') {
|
||||
var relativeTime = timeImageSet["00720038"].Value[0], timeUnits = timeImageSet["0072003A"].Value[0];
|
||||
var timeBasedImageSetsSequence = imageSet['00720030'].Value;
|
||||
timeBasedImageSetsSequence.forEach(function(timeImageSet) {
|
||||
var setNumber = timeImageSet['00720032'].Value[0], selectorCategory = timeImageSet['00720034'].Value[0];
|
||||
|
||||
var mImageSet = new DICOMHP.imageSet(setNumber, selectorCategory);
|
||||
if (selectorCategory == 'RELATIVE_TIME') {
|
||||
var relativeTime = timeImageSet['00720038'].Value[0], timeUnits = timeImageSet['0072003A'].Value[0];
|
||||
|
||||
mImageSet.setRelativeTime(relativeTime);
|
||||
mImageSet.setTimeUnits(timeUnits);
|
||||
} else if (selectorCategory == 'ABSTRACT_PRIOR') {
|
||||
var priorValue = timeImageSet["0072003C"].Value[0];
|
||||
mImageSet.setRelativeTime(relativeTime);
|
||||
mImageSet.setTimeUnits(timeUnits);
|
||||
} else if (selectorCategory == 'ABSTRACT_PRIOR') {
|
||||
var priorValue = timeImageSet['0072003C'].Value[0];
|
||||
|
||||
mImageSet.setPriorValue(priorValue);
|
||||
}
|
||||
mImageSet.setPriorValue(priorValue);
|
||||
}
|
||||
|
||||
matchedImageSets.push(mImageSet);
|
||||
matchedImageSets.push(mImageSet);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return matchedImageSets;
|
||||
};
|
||||
return matchedImageSets;
|
||||
};
|
||||
Reference in new issue
Block a user