[Dcmlib] AnonymizeNoLoad() (BIS)
Jean-Pierre Roux
jpr at creatis.insa-lyon.fr
Mon Oct 16 15:52:16 CEST 2006
Jean-Pierre Roux wrote:
>Greg Book wrote:
>
>
>
>>I'm attempting to anonymize a file using
>>gdcm::File::AnonymizeNoLoad(). I use the following code, but the file
>>is not anonymized, the file date is not changed either.
>>What might be happening?
>>
>>
>
>
>
--> OK : my answer may look strange
Please use
f->Load()
juste before using
f->AnonymizeNoLoad()
This is not a mistake, just a stupid name for AnonymizeNoLoad :
NoLoad was *not* "don't load the file header", but "don't load the pixels in memory".
The right name should be :
AnonymizeNoGetData
Jean-Pierre Roux
>>Thanks,
>>Greg
>>
>> /* open dicom file */
>> f = new gdcm::File();
>> f->SetLoadMode(gdcm::LD_ALL);
>> f->SetFileName(filelist.Item(i).c_str());
>>
>>
>
>I'm not on my PC, and I cannot check, but I think you should Load the
>gdcm::File here.
>
> if ( !f->Load() )
> {
> std::cout << "[" << fileName << "] is not a gdcm-readable file"
> << std::endl;
> f->Delete();
> return 1;
> }
>
>(Have a look at Example/AnonymizeNoLoad.xx)
>HTH
>Jean-Pierre Roux
>
>
>
>> /* determine which fields to anonymize */
>> if (chkPatientName->GetValue())
>> f->AddAnonymizeElement( 0x0010, 0x0010,
>>txtPatientName->GetValue().c_str());
>> if (chkPatientBirthdate->GetValue())
>> f->AddAnonymizeElement( 0x0010, 0x0030,
>>txtPatientBirthdate->GetValue().c_str());
>> if (chkStudyDate->GetValue())
>> f->AddAnonymizeElement( 0x0008, 0x0020,
>>txtStudyDate->GetValue().c_str());
>> if (chkSeriesDate->GetValue())
>> f->AddAnonymizeElement( 0x0008, 0x0021,
>>txtSeriesDate->GetValue().c_str());
>>
>> /* close the file */
>> f->AnonymizeNoLoad();
>> f->ClearAnonymizeList();
>> delete f;
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Dcmlib mailing list
>>Dcmlib at creatis.insa-lyon.fr
>>http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
>>
>>
>>
>_______________________________________________
>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