[Dcmlib] AnonymizeNoLoad() (BIS)
Jean-Pierre Roux
jpr at creatis.insa-lyon.fr
Fri Oct 20 11:05:13 CEST 2006
Greg Book wrote:
> I added f->Load(), but still nothing happens. This is on Windows XP,
> using gdcm 1.2.2 downloaded from sourceforge. Here is the new code:
>
> for (i=0;i<filelist.Count();i++) {
> /* open dicom file */
> f = new gdcm::File();
> f->SetLoadMode(gdcm::LD_ALL);
> f->SetFileName(filelist.Item(i).c_str());
> /* determine which fields to anonymize */
--> I'm not sure of what you want to do here :
--> What is chkPatientName?
--> When I replace, in your code the following lines by :
f->AddAnonymizeElement( 0x0010, 0x0010, "g^Fantomas" );
f->AddAnonymizeElement( 0x0010, 0x0030,"11111111" );
f->AddAnonymizeElement( 0x0008, 0x0020, "11111111");
etc
the file is anonymized ?!?
Jean-Pierre
> 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());
>
> if (!f->Load()) {
> delete f;
> continue;
> }
> f->AnonymizeNoLoad();
> f->ClearAnonymizeList();
> /* close the file */
> delete f;
> }
>
> -Greg
>
>
>
>
> Jean-Pierre Roux wrote:
>
>> 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