[Dcmlib] Never trust the programer :)
Mathieu Malaterre
mathieu.malaterre at kitware.com
Fri Oct 21 20:41:19 CEST 2005
God ! I wish we never switch to speak english, it is making so much
confusion.
Benoit:
No your code is *slightly* different from the previous one, because it
is now asynchronous. You are testing only once if the number of value
count is actually 3. Whereas we could *imagine* a case where you could
deduct a value from: first an array of 3 and if if fails deduct the same
value from an array of 1. Therefore you have to test first that
GetValueCount() == 3 and *then* test GetValueCount() == 1. But I agree
that in your case it should work since RET and non-RET tags seems to
always keep the same VM (when properly written in the dict :-P).
JP:
So far the only mistake*s* (plural form) I corrected were on *our* side.
So blaming manufacturer all the time, is kind of lame. First we should
admit that our ACR-NEMA dict is not perfect, then correct it. And then
after blame the constructor :). Seriously none of the VM for Orientation
and Position were right... I mean com'on !
But I do agree that my assert is too strong in particular for the super
duper 'special' case where Spacing is written with a VM of 3. I'll have
to think about it. But right now I am just going over the ACR-NEMA dict
which is IMHO not up to date at all.
My 2 cents, sorry if I hurt your feelings :(
Mathieu
Jean-Pierre Roux wrote:
> Mathieu Malaterre wrote:
>
>> Benoit,
>>
>> I just added an assert for kick and it is seg faulting. For instance:
>
>
>
> Mathieu.
>
> Be carefull with the VM : I added them manualy in our dicomV3.dic.
> Nobody used them till now ...
>
> And think of the bozos that produce supposed to be Dicom images.
> We coded a lot of heuristics to allow gdcm Reader to go on when a
> duscrepancy is found (dicomV3.dic vs current Dicom Image -being read-)
> ex : Pixel Spacing has a VM = 2;
> We have images where a single value is found (assume the pixel is square)
> We have images where 3 values are found (We know the middle one is
> always 0 ?!?, just ignore it)
> If you check too much, you'll have more 'gdcm breaker images'.
>
> VM should be usefull to enforce consistency, no allowing user to *write*
> illegal stuff.
> Or inside a checker, that would warn user the image is not kosker.
> But *not* hanging gdcm.
> IMO...
>
> JPRx
>
>>
>> DataEntry *entry = GetDataEntry(0x0020,0x0032);
>> if( !entry )
>> {
>> gdcmWarningMacro( "Unfound Image Position Patient (0020,0032)");
>> entry = GetDataEntry(0x0020,0x0030);
>> if( !entry )
>> {
>> gdcmWarningMacro( "Unfound Image Position (RET) (0020,0030)");
>> return 0.0f;
>> }
>> }
>>
>> if( entry->GetValueCount() == 3 )
>> {
>> gdcmAssertMacro( entry->IsValueCountValid() );
>> return (float)entry->GetValue(0);
>> }
>> return 0.0f;
>>
>> so if 0x0020,0x0032 is not found, you check 0x0020,0x0030, which is
>> then found. But if it is found THEN you compare entry->GetValueCount()
>> against 3, but how do you know that VM is the same for 0020,0032 and
>> 0020,0030 ?
>>
>> Anyway this could have been safe, unfortunately 0020,0030 was entered
>> as VM=1 in the dict.
>>
>> Question: Is this safe to let the programmer use GetValueCount ? Or
>> should we enforce IsValueCountValid ? Maybe an alternative would be to
>> run IsValueCountValid on the whole gdcmData just to see how respectful
>> the DICOM data are to 'our' dict...
>>
>> Mathieu
>> _______________________________________________
>> 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