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

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Nov 12 17:52:35 CET 2004


Mathieu Malaterre wrote:
> Jean-Pierre Roux wrote:
> 
>>> Dennis,
>>>
>>>     I am really suspicious. I only know one image that had odd 
>>> lenght, and
>>> it was an image written by an old gdcm version. Two options here:
>>>
>>
>>
>> --> Mathieu :
>> Actually, there is a lot of DICOM images with odd length for some fields
>> (not only old gdcm version written images ...)
>> Of course, it's a violation of DICOM rules, but who cares about DICOM
>> rules :-(
> 
> 
> JP,
> 
>     Show me one DICOM in the baseLine that does not respect this rule 
> (except the theralys one and the broken GE 13 lenght). I think there is 
> a confusion in between MONOCHROM1 that has 11 character and the string 
> that carry it that is padded with a null caracter (as specified in DICOM 
> ref). I put a tons of assert everywhere to make sure about this issue, 
> and I had an issue only with those two.


Ok I think I understand the problem. You are saying that when we read a 
"MONOCHROM1" followed by a null character (which is an even lenght 
string), this string creates a problem when compared to "MONOCHROM1 "

In that case I agree.

I'll propose a function (in Util) something like:

bool DcmStrEqual(string a, string b)
{
   if( a == b ) return true;
   if( a == b + ' ') return true;
}

I do so, in order to abstract the notion of DicomString. I don't want to 
see in the code :

std:string strPINoSpace(strPhotometricInterpretation, 0,
strPhotometricInterpretation.find_first(' '));

which is /photometric/ dependant, so we do this for every string we want 
to compare, or we do it for none of them...

Mathieu





More information about the Dcmlib mailing list