I am trying to do volume rendering using one of the open source project. I want to create a surface file from my DICOM images. I know this is possible by using mango viewer exe; but I want to do it using javascript. Please help me.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="papaya.css" />
<script type="text/javascript" src="papaya.js"></script>
<script type="text/javascript">
var finalImages = [];
var images = window.opener.imageIds;
for (var i = 0; i < images.length; i++)
{
if (images[i].substr(0, 8) == "dicomweb")
{
temp = images[i].substr(9, images[i].length);
//images[i] = "http:" + images[i];
finalImages.push("http:" + temp);
}
}
var params = [];
params["images"] = [finalImages];
params["surfaces"] = [];
</script>
<title>Papaya Viewer</title>
</head>
<body>
<div class="papaya" data-params="params">
</div>
</body>
</html>
Unfortunately, Papaya only supports reading surface files (VTK, GIFTI, etc) not generating them.
If you want to do it yourself in JavaScript, looking into Marching Cubes. This is what Mango uses and I think is a common approach to converting image volume data to surface data. (See this and also this.)
Once you've created your surface data (triangles, indices) you'll need to organize it into a format Papaya can read. VTK is probably the simplest, but here's the complete list of supported formats.