Actually, the error message gives a good clue: the value of the “data” variable is a Node, not the Node.data that one would expect to pass to Model.setDataProperty.
Furthermore, have you examined the value of encodedFile.srcElement.result in the debugger?
Also, why are you using the onloadend event rather than implementing separate onload and onerror events?
As a separate comment, it would be better to write your loop within the transaction as follows:
myDiagram.selection.each(function(part) {
if (part.category === "Picture") {
myDiagram.model.setDataProperty(part.data, "source", ...);
}
});