cancel
Showing results for 
Search instead for 
Did you mean: 

Dicom Images

sjeek
Champ in-the-making
Champ in-the-making
Hi,

We added a inline viewer to alfresco, so we can view our images directly in alfresco. Now, we want to extend this viewer for dicom images (Digital Imaging and Communications in Medicine)

But, does anyone know how i can convert a dicom image to an AWT image or even a jpg?
Dicom images also have mutilayers…

grtz
6 REPLIES 6

sjeek
Champ in-the-making
Champ in-the-making
It would be possible with ImageMagick, I think, but I don't know it will work in alfresco…?

steve
Champ in-the-making
Champ in-the-making
Hello,

Alfresco uses Imagemagick to perform image transformations.

You can specify exactly what options you pass to Imagemagick so if Imagemagick can perform the transfomations you require then you should be able to store and transform your images from within Alfresco.

A quick check of the Imagemagick formats has shown that it supports DCM images (Digital Imaging and Communications in Medicine (DICOM) image).

Hope this helps,

Steve

sjeek
Champ in-the-making
Champ in-the-making
When I convert a dicom image with ImageMagick, the colors are so bad, that I would cry  Smiley Happy

Now, I found a toolkit dcm4che where I found some code that I used.
For now, I used also a file of my own system, because I can't read the file from alfresco yet


if (MimetypeMap.MIMETYPE_IMAGE_DICOM.equals(mimetype)) {

            // make content available
            if (reader != null) {

               Image test = null;

               File f = new File("file://C:\\CT-MONO2-16-brain.dcm");
               //File f = new File("http://10.128.239.194:7001/alfresco/download/direct/workspace/SpacesStore/78d3ad12-cf81-11da-b921-e3...");
               
               //File dest = TempFileProvider.createTempFile("out", ".jpg");
               File dest = new File("file://C:\\out.jpg");               
               
               try {
                  ImageInputStream iis = ImageIO.createImageInputStream(f);
                  Iterator iter = ImageIO.getImageReadersByFormatName("DICOM");
                  ImageReader imgReader = (ImageReader) iter.next();
                  imgReader.setInput(iis, false);
                  test = imgReader.read(0);

                  OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
                  JPEGImageEncoder enc = JPEGCodec.createJPEGEncoder(out);
                    enc.encode((BufferedImage)test);
                   
                    String content = "<img src='" + dest.getAbsolutePath() + "'/>";
                   
                    setInlineContent(content);
               } catch (Exception e) {
                  e.printStackTrace();
               }

Now, Can someone tell me please how i can call a file from alfresco (maby with a node? or with an other way?) and how i can show it?

I try'd with the TempFileProvider, but I think, i'am doing something wrong…

grtz

sjeek
Champ in-the-making
Champ in-the-making
I can call a file from my system
File f = new File("C:\\CT-MONO2-16-brain.dcm");

But, it it possible to work with "File" with a url from a content in Alfresco?

sjeek
Champ in-the-making
Champ in-the-making
or is it possible to, when I click on a dicom image, so on a content, that i can download the image to a temp folder directly?

I would like to do this offcourse with the "File" statement, but, if that's not an option, I can try it with the download option? 

any help please?  Smiley Happy

greetings

sjeek
Champ in-the-making
Champ in-the-making
Normally, it would work with the CIFS server, but I (god knows for what reason) cant' start the server.

Is it possible, when I click on a content, I can download the image to a temp file on my local drive? so i can use the "File f = new file(…)" option that way?