ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 [IEvolution] Reading dicom data using dcm4che3

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
karthikvadla16 Posted - Aug 15 2016 : 18:48:18
Hi All,

I have a requirement to create a matrix for each .dcm image using pixel data. I tried below code using dcm4che in scala. I keep getting EOF exception when i specify ds.readDataset(-1,-1).

Can anyone help me with this.
Really appreciate your help.

Code:
---------

import java.io.{ByteArrayInputStream}
import org.dcm4che3.data.Tag
import org.dcm4che3.imageio.plugins.dcm.{DicomMetaData}
import org.dcm4che3.io.{BulkDataDescriptor, DicomInputStream}
import org.dcm4che3.io.DicomInputStream.IncludeBulkData
import org.scalatest.Matchers

class DicomTest extends TestingSparkContextWordSpec with Matchers {

"dicom folder" should {
"contain 9 files" in {

//dicomimages folder is within spark-rk/core
val dicomRdd = sparkContext.wholeTextFiles("dicomimages")
val printbytes = dicomRdd.map { case (filepath, filedata) => filedata.getBytes().length }
printbytes.foreach(println)

val disRdd = dicomRdd.map { case (filepath, filedata) => new DicomInputStream(new ByteArrayInputStream(filedata.getBytes())) }

val dm = disRdd.map {
case dis =>
dis.setIncludeBulkData(IncludeBulkData.URI);
dis.setBulkDataDescriptor(BulkDataDescriptor.PIXELDATA);
dis.setURI("java:iis"); // avoid copy of pixeldata to temporary file
val fmi = dis.readFileMetaInformation();
val ds = dis.readDataset(-1, -1);
new DicomMetaData(fmi, ds)
}

dm.map(m => m.getAttributes.getValue(Tag.PixelData)).foreach(println)
}
}

}



Error: (Please see attachment for complete error stack)
-------------
Caused by: java.io.EOFException
at org.dcm4che3.util.StreamUtils.readFully(StreamUtils.java:63)
at org.dcm4che3.io.DicomInputStream.readFully(DicomInputStream.java:383)
at org.dcm4che3.io.DicomInputStream.readValue(DicomInputStream.java:711)
at org.dcm4che3.io.DicomInputStream.readValue(DicomInputStream.java:536)
at org.dcm4che3.io.DicomInputStream.readAttributes(DicomInputStream.java:497)

Karthik

Download Attachment: 2016815184739_eof_exception.txt
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 15 2016 : 21:35:08
I'm afraid this forum is just for users of ImageEn and IEvolution.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com