Hey all,

i just wanted to continue on the DICOM-Feature for Owncloud (v 7.0.4.2 on
debian) but got stuck.

First thing i would like to get working is thumbnail-preview (dicom viewer
would be nice, but i am not a professional developer, so starting with a
small job seems better) using your hints from this conversation to get
started.

Converting dicom to image with Imagick works fine using this code for
example:

<?php
$data = new imagick( 'test.dcm' ); 
$data->setImageFormat('jpeg');
$im = imagecreatefromstring($data);
header('Content-Type: image/jpeg');
imagejpeg($im);
?>

As the PDF thumbnail Preview uses imagick too - i tried this way:
* duplicate of lib/private/preview/pdf.php named dicom.php with this code:

                class DICOM extends Provider {

                        public function getMimeType() {
                                return '/application\/dicom/';
                        }

                        public function getThumbnail($path, $maxX, $maxY, 
$scalingup, $fileview)
{
                                $tmpPath = $fileview->toTmpFile($path);

                                //create imagick object from pdf
                                try{
                                        $dicom = new Imagick($tmpPath);
                                        $dicom->setImageFormat('jpg');
                                } catch (\Exception $e) {
                                        \OC_Log::write('core', 
$e->getmessage(), \OC_Log::ERROR);
                                        return false;
                                }

                                unlink($tmpPath);

                                //new image object
                                $image = new \OC_Image($dicom);


* add the mimetype application\dicom to lib/private/mimetypes.list.php
* include the dicom.php in lib/private/preview/preview.php
* enabled preview providers 'OC\Preview\DICOM' in /config/config.php

owncloud.log is not very helpful, and i dont know where my problem is
located. the output of  imagick should be the same as with PDF i think ?!

Thanks for your help in advance!
Julius



--
View this message in context: 
http://owncloud.10557.n7.nabble.com/Viewing-medical-DICOM-images-with-ownCloud-tp12927p13767.html
Sent from the Developers mailing list archive at Nabble.com.
_______________________________________________
Devel mailing list
Devel@owncloud.org
http://mailman.owncloud.org/mailman/listinfo/devel

Reply via email to