[Dcmlib] Re: some bugs with 'MONOCHROM1 ' and 'MONOCHROM2 '

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Nov 12 20:51:04 CET 2004


Thanks a lot Dennis !

As mentionned by Jean-Pierre, I did some changed to better handle DICOM 
string (even lenght). Thus I got back to gdcm 0.5 (which did not pay 
attention to string lenght. And I did:

(from CTHead)
~/Creatis/gdcm-05-gcc/bin/PrintHeader 0001.dcm

...
0028|0004 lg :       x(c) 12       Off.:     x(46a) 1130    [CS] 
                                  [Photometric Interpretation] [MONOCHROME2]
...

The string is 12 character long, but you are correct we were doing bad 
string comparison, thanks for bug report.

Your code looks fine too, but I am looking for something more robust. 
For instance there are few chances that a DICOM image is written with:

"MONOCHROM1   " (3 spaces)

So I would like string comparison to only deal with last character, what 
do you think ?

Keep in touch,
Mathieu

derong wrote:
> Hi, Mathieu,
>  
> I got some dataset in http://www.julius.caesar.de/4000/4500.html. The 
> Dicom images in (CT Head) have "MONOCHROM1".
> For your  proposal, function DcmStrEqual(string a, string b), parmeter 
> 'a' should not be followed by space.
> I think the function like follows:
>  
> bool DcmStrEqual(const std::string& a, const std::string& b)
> {  // suppose no space exists between words, space only in the tail
>   std::string aNSpace(a, 0, a.find_first(' ');
>   std::string bNSpace(b, 0, b.find_first(' ');
>   return aNSpace == bNSpace;
> }
>  
> thx,
>  
> Dennis
>  
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Dcmlib mailing list
> Dcmlib at creatis.insa-lyon.fr
> http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib






More information about the Dcmlib mailing list