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
@@ -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;
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user