DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Sun, 2017-12-17, 09:11

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PHP DICOM Class
PostPosted: Fri, 2011-04-08, 16:28 
Offline

Joined: Fri, 2011-04-08, 16:14
Posts: 4
class_dicom.php is a PHP class that lets you work with DICOM files within PHP programs. class_dicom.php enables you to retrieve tags, write tags, convert to JPEG, make thumbnails, convert JPEG to DICOM, compress DICOM, uncompress DICOM, receive DICOM files over the network, and send DICOM files over the network. It even comes with several example programs so you can get started writing your own code right away!

class_dicom.php relies on the OFFIS DICOM Toolkit.

My aim was to keep the interface as simple as possible while at the same time providing a class that would be easy to grow.

You can get a copy, along with documentation at: http://www.deanvaughan.org/projects/class_dicom_php/


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-04-08, 19:49 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
Thanks for using DCMTK for your project and for you posting in this forum :-)

Btw, I just browsed trough your main PHP file: There's no need to distinguish between JPEG-compressed and uncompressed DICOM images; you can always use "dcmj2pnm" in order to create JPEG output images. This also avoids the use of ImageMagick's "convert" for the conversion from TIFF to JPEG. Furthermore, dcm2pnm/dcmj2pnm allow for scaling the output image, e.g. in order to create icons/thumbnails.

For the storescp call in debug mode, you should probably better use "-v -d" instead of "-d -v" because in DCMTK 3.6.0 verbose (INFO) and debug (DEBUG) mode are mutually exclusive and the righter most option "wins" - the latter was already the case in previous DCMTK versions.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-04-08, 21:26 
Offline

Joined: Fri, 2011-04-08, 16:14
Posts: 4
Jörg Riesmeier wrote:
Awesome suggestions


Wow, thanks!

I've implemented your suggestions, they certainly lead to simpler code!


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-04-08, 22:02 
Offline
ICSMED DICOM Services
ICSMED DICOM Services

Joined: Fri, 2004-10-29, 21:38
Posts: 2217
Location: Oldenburg, Germany
That was fast :-) Two short comments on the new version:

Code:
    $jpg_quality = 95;

    $this->jpg_file = $this->file . '.jpg';
    $this->tiff_file = $this->file . '.tiff';
   
    if(!$this->transfer_syntax) {
      $tags = new dicom_tag;
      $tags->file = $this->file;
      $tags->load_tags();
      $this->transfer_syntax = $tags->get_tag('0002', '0010');
    }

    if(strstr($this->transfer_syntax, 'Baseline') || strstr($this->transfer_syntax, 'Lossless')) {
      $jpg_quality = 100;
    }


I guess the TIFF filename is not needed any longer, right?

Also, I don't think that a JPEG quality of 95% or even 100% is really useful. Shouldn't 90% be sufficient? And, what's also interesting: For uncompressed images you are now using a quality of 95%, while you are using 100% for JPEG-Lossless and JPEG-Baseline (8-bit lossy). Or did I misinterpret you code?


Top
 Profile  
 
 Post subject:
PostPosted: Mon, 2011-04-11, 14:29 
Offline

Joined: Fri, 2011-04-08, 16:14
Posts: 4
I was about halfway through typing up a reply about how it makes sense to me, but then I realized it's just my opinion and it didn't have much bearing on anything.

I've changed the JPEG quality to be a value you can set on the class. It defaults to 100, but you can always change it to whatever you would like it to be.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group