On 3 November 2011 11:14, Kris Thielemans <kris.f.thielem...@gmail.com> wrote: > Hi > I discovered that Andy Buckle has made some routines available for DICOM > support in Octave. See also http://wiki.octave.org/wiki.pl?CategoryDicom. > Thanks Andy! > > I've made some changes to the files currently in svn > (octave-forge/extra/dicom/). However, I don't have write access to the svn, > so I've attached them to this email as a patch. I'd be very happy if this > would be committed. > > This code works fine for me on Ubuntu 11.04 and allows me to read GE Dicom > PET and CT images, and GE raw data, which was a very pleasant surprise. With > this update, I think this dicom package is much closer to being ready and > compatible with matlab. I haven't looked at dicomwrite though. Also, there's > a TODO in dicominfo.cpp related to error handling if a dictionary is not > found. I also have some doubts if the code properly handles different > endianness, but am not familiar enough with gdcm to know for sure (and don't > seem to have the data to check it). > > Note that I'm rather new to octave, so I'm sure that the C++ code can be > improved. Also, I'm not quite sure about conventions to be used for the > texinfo documentation (e.g.: how do you write an argument that's a string?) > so somebody should/could correct this. > > Here's a summary of the changes > ------------------------------------------------------------ > All files: changed include of gdcm files to use gdcm-2.0/ path, which is I > think how it should be done. That also meant I don't have to add an include > flag anymore after installing the gdcm package on Ubuntu. > > dicomread.cpp: > - support usage where 1st argument is a structure with a field Filename > (such as returned by dicominfo) for matlab compatibility. > > dicomdict.cpp: > - make sure that 'get' and 'set' behaviour works correctly. To do that, > there's now a static variable storing the current dictionary name and a > function get_current_dict() to access it. I didn't remove Andy's disabled > code for using a dictionary object, but I don't think it's necessary as we > can get away with a string. > - updated doc-string > > dicomdict.h: > - moved declaration of load_dict() here to make it accessible in the other > routines > - declare new function get_current_dict() > > dicominfo.cpp: > - support usage dicominfo(filename, 'dictionary', dictname) > - support FL, FD and SL VRs, which means that many more fields are now read > correctly from the dicom file. > - check if the VR in the file is the same as the one in the dictionary. If > not, issue a warning but use the VR from the file. > - assign values to private dicom fields > - changed convention for private fields to use lower-case for the > hexadecimal numbers to be compatible with Matlab > - if an entry is not in the dictionary, determine its VR from the file (if > possible) and assign anyway. > - updated doc-string > > Makefile: > - set include flag empty > - removed a few gdcm components that aren't installed with the gdcm ubuntu > package (do they still exist?) and aren't necessary anyway. > -------------------------------------------------------- > > Finally, a comment for the wiki at > http://wiki.octave.org/wiki.pl?CategoryDicom > > Question: Octave (and Matlab) stores images (y,x) and DICOM is intrinsically > (x,y). Does Matlab transpose images when it loads them? > > Answer: matlab reads the data from the dicom file as if it's a raw block of > numbers (and then converts if necessary). Therefore, current Octave/dicom > behaviour is compatible with matlab. > > > I hope this is useful for someone. Andy's code (and Octave!) was certainly > useful for me.
Hi Kris I added your note to the wiki. Also, if no one objects to your patch in 3 days, I'll apply (or ping us back if for some reason it's not done). Thank you Carnë ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev