[Insight-users] GDCM and ITK

John Drescher drescherjm at gmail.com
Mon Mar 30 15:41:58 EDT 2009


On Mon, Mar 30, 2009 at 2:36 PM, John Drescher <drescherjm at gmail.com> wrote:
> On Mon, Mar 30, 2009 at 9:52 AM, Mathieu Malaterre
> <mathieu.malaterre at gmail.com> wrote:
>> On Mon, Mar 30, 2009 at 3:44 PM, John Drescher <drescherjm at gmail.com> wrote:
>>>>>>>  And the reader has empty strings
>>>>>>> for GetPatientName GetPatientSex ...
>>>>>>
>>>>>> This has been fixed a couple of weeks ago...
>>>>>>
>>>>>> Thanks for report...
>>>>>>
>>>>> So I would need the cvs itk for that? Or cvs gdcm? Or both?
>>>>
>>>> ITK CVS should be enough :)
>>>>
>>>
>>> Thank You, I will try that today.
>>
>> MetaDict should be fixed too.
>>
>>
>> $ cvs ci -m"BUG: need to fill in metaheader (John Drescher on itk ML)"
>> ...
>> /cvsroot/Insight/Insight/Code/IO/itkGDCMImageIO.cxx,v  <--  itkGDCMImageIO.cxx
>> new revision: 1.152; previous revision: 1.151
>>
> I updated to the cvs but I am still having problems. Now I get:
>
> (000|,0000) Command Group Length = QAMAAA==
> (000|,0005) Command Group Length = ISO_IR 100
> (000|,0008) Command Group Length = ORIGINAL\PRIMARY\AXIAL
> (000|,0012) Command Group Length = 20070101
> (000|,0013) Command Group Length = 083643
> (000|,0016) Command Group Length = 1.2.840.10008.5.1.4.1.1.2
> (000|,0018) Command Group Length =
> 1.2.840.113619.2.55.3.3852317604.917.1197675103.288.1
> (000|,0020) Command Group Length = 20071215
> (000|,0021) Command Group Length = 20070101
> (000|,0022) Command Group Length = 20070101
> (000|,0023) Command Group Length = 20070101
> (000|,0030) Command Group Length = 083525
> (000|,0031) Command Group Length = 083620
> (000|,0032) Command Group Length = 083639
> (000|,0033) Command Group Length = 083643
> (000|,0050) Command Group Length = 5
> (000|,0060) Command Group Length = CT
> (000|,0070) Command Group Length = GE MEDICAL SYSTEMS
> (000|,0080) Command Group Length = UPMC Hillman Cancer Center
> (000|,0090) Command Group Length = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> (000|,1010) Command Group Length = hccct2
> (000|,1030) Command Group Length = CT THORAX  WITHOUT CON
> (000|,103e) Command Group Length =
> (000|,1060) Command Group Length = HCT
> (000|,1070) Command Group Length = LDM
> (000|,1090) Command Group Length = LightSpeed VCT
> (001|,0000) Command Group Length = ngEAAA==
> (001|,0010) Command Group Length = 1-0065-6
> (001|,0020) Command Group Length = HB011236
> (001|,0022) Command Group Length = HELICAL MODE
> (001|,0030) Command Group Length = 19380101
> (001|,0040) Command Group Length = M
> (001|,0050) Command Group Length = 2.500000
> (001|,0060) Command Group Length = 120
> (001|,0090) Command Group Length = 500.000000
> (001|,1010) Command Group Length = 070Y
> (001|,1020) Command Group Length = 07MW18.4
> (001|,1030) Command Group Length = 5.30 SCCOR-1 PROTOCOL
> (001|,1100) Command Group Length = 360.000000
> (001|,1110) Command Group Length = 949.075012
> (001|,1111) Command Group Length = 541.000000
> (001|,1120) Command Group Length = 0.000000
> (001|,1130) Command Group Length = 157.000000
> (001|,1140) Command Group Length = CW
> (001|,1150) Command Group Length = 400
> (001|,1151) Command Group Length = 250
> (001|,1152) Command Group Length = 12
> (001|,1160) Command Group Length = BODY FILTER
> (001|,1170) Command Group Length = 30000
> (001|,1190) Command Group Length = 0.700000
> (001|,1210) Command Group Length = LUNG
> (001|,21b0) Command Group Length = XXXXXX
> (001|,5100) Command Group Length = FFS
> (001|,9305) Command Group Length = AAAAoJmZ2T8=
> (001|,9306) Command Group Length = AAAAAAAA5D8=
> (001|,9307) Command Group Length = AAAAAAAANEA=
> (001|,9309) Command Group Length = AgDy+f83SEA=
> (001|,9310) Command Group Length = AAAAAABgM0A=
> (001|,9311) Command Group Length = AAAAAAAA7z8=
> (002|,0000) Command Group Length = uAAAAA==
> (002|,0002) Command Group Length = AQA=
> (002|,0004) Command Group Length = MONOCHROME2
> (002|,000d) Command Group Length =
> 1.2.840.113619.2.55.3.3852317604.917.1197675103.283
> (002|,000e) Command Group Length =
> 1.2.840.113619.2.55.3.3852317604.917.1197675103.287
> (002|,0010) Command Group Length = AAI=
> (002|,0011) Command Group Length = AAI=
> (002|,0012) Command Group Length = 1
> (002|,0013) Command Group Length = 1
> (002|,0030) Command Group Length = 0.703125\0.703125
> (002|,0032) Command Group Length = -185.300\-180.000\-26.000
> (002|,0037) Command Group Length =
> 1.000000\0.000000\0.000000\0.000000\1.000000\0.000000
> (002|,0052) Command Group Length =
> 1.2.840.113619.2.55.3.3852317604.917.1197675103.284.19475.5
> (002|,0100) Command Group Length = EAA=
> (002|,0101) Command Group Length = EAA=
> (002|,0102) Command Group Length = DwA=
> (002|,0103) Command Group Length = AQA=
> (002|,0120) Command Group Length = MPg=
> (002|,1040) Command Group Length = SN
> (002|,1041) Command Group Length = -26.000
> (002|,1050) Command Group Length = -500
> (002|,1051) Command Group Length = 1500
> (002|,1052) Command Group Length =  -1024
> (002|,1053) Command Group Length =  1
> (002|,1054) Command Group Length = HU
> (004|,0000) Command Group Length = 0gEAAA==
> (004|,0244) Command Group Length = 20070101
> (004|,0245) Command Group Length = 083525
> (004|,0253) Command Group Length = PPS ID  11566
> (004|,0254) Command Group Length = CT THORAX  WITHOUT CON
> (7fe|,0000) Command Group Length = DAAIAA==
>
> Here is the code:
>
>                        DictionaryType::ConstIterator itr = dictionary.Begin();
>                        DictionaryType::ConstIterator end = dictionary.End();
>
>                        while( itr != end )
>                        {
>                                itk::MetaDataObjectBase::Pointer  entry = itr->second;
>
>                                MetaDataStringType::Pointer entryvalue =
>                                        dynamic_cast<MetaDataStringType *>( entry.GetPointer() ) ;
>
>                                if( entryvalue )
>                                {
>                                        std::string tagkey   = itr->first;
>
>                                        QString strElem = tagkey.c_str();
>
>                                        strElem = strElem.right(4);
>
>                                        // Ignore "Group Lengths"
>                                        if (strElem.compare("0000")) {
>                                                std::string labelId;
>                                                itk::GDCMImageIO::GetLabelFromTag( tagkey, labelId );
>                                                std::string tagvalue = entryvalue->GetMetaDataObjectValue();
>                                                //std::cout << tagkey <<  " = " << tagvalue << std::endl;
>
>                                                str += QString("%1 %2 = %3\n")
>                                                        .arg(tagkey.c_str())
>                                                        .arg(labelId.c_str())
>                                                        .arg(tagvalue.c_str());
>                                        }
>                                }
>
>                                ++itr;
>                        }
>                        textEdit->setText(str);
>                }
>
>
> I have inspected tagkey at
>
> std::string tagkey   = itr->first;
>
> and it does have a "|" 0x7c in the group part.
>
> John
>

The cause appears to be that the tags are stored as

"(XXXX,XXXX)"

So when you

std::string PrintAsPipeSeparatedString(const gdcm::Tag& tag)
1008 	  	 {
1009 	  	   itksys_ios::ostringstream os;
1010 	  	   os << tag;
1011 	  	   std::string ret = os.str();
1012 	  	   ret[4] = '|';
1013 	  	   return ret;
1014 	  	 }

its getting the wrong index for ret of 4 instead of 5.

The following function is also not working correctly because of the
"(" and ")" in the tag.

Tag::ReadFromPipeSeparatedString is the

the sscanf is failing

 if( sscanf(str, "%04x|%04x", &group , &element) != 2 )

This is causing GetLabelFromTag to return "Command Group Length" always.

-- 
John M. Drescher


More information about the Insight-users mailing list