[Dcmlib] AnonymizeNoLoad()

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Mon Oct 16 13:09:37 CEST 2006


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?

> 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
>



More information about the Dcmlib mailing list