<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000066">
I finally got around to working on it last night. I now have the
following code, but the dicom file is not anonymized. I put in a break
point, and the file object has the correct anonymize elements.<br>
<br>
f = new gdcm::File();<br>
f->SetLoadMode(gdcm::LD_ALL);<br>
f->SetFileName(filelist.Item(i).c_str());<br>
if (!f->Load()) {<br>
delete f;<br>
continue;<br>
}<br>
<br>
f->AddAnonymizeElement( 0x0010, 0x0010, "Non^Person");<br>
<br>
f->AnonymizeNoLoad();<br>
f->ClearAnonymizeList();<br>
delete f;<br>
<br>
-Greg<br>
<br>
<br>
<br>
Jean-Pierre Roux wrote:
<blockquote cite="mid45389149.6040406@creatis.univ-lyon1.fr" type="cite">Greg
Book wrote:
<br>
<br>
<blockquote type="cite">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:
<br>
<br>
for (i=0;i<filelist.Count();i++) {
<br>
/* open dicom file */
<br>
f = new gdcm::File();
<br>
f->SetLoadMode(gdcm::LD_ALL);
<br>
f->SetFileName(filelist.Item(i).c_str());
<br>
/* determine which fields to anonymize */
<br>
</blockquote>
<br>
<br>
--> I'm not sure of what you want to do here :
<br>
--> What is chkPatientName?
<br>
--> When I replace, in your code the following lines by :
<br>
f->AddAnonymizeElement( 0x0010, 0x0010, "g^Fantomas" );
<br>
f->AddAnonymizeElement( 0x0010, 0x0030,"11111111" );
<br>
f->AddAnonymizeElement( 0x0008, 0x0020, "11111111");
<br>
etc
<br>
the file is anonymized ?!?
<br>
<br>
Jean-Pierre
<br>
<br>
<blockquote type="cite"> if (chkPatientName->GetValue())
<br>
f->AddAnonymizeElement( 0x0010, 0x0010,
txtPatientName->GetValue().c_str());
<br>
if (chkPatientBirthdate->GetValue())
<br>
f->AddAnonymizeElement( 0x0010, 0x0030,
txtPatientBirthdate->GetValue().c_str());
<br>
if (chkStudyDate->GetValue())
<br>
f->AddAnonymizeElement( 0x0008, 0x0020,
txtStudyDate->GetValue().c_str());
<br>
if (chkSeriesDate->GetValue())
<br>
f->AddAnonymizeElement( 0x0008, 0x0021,
txtSeriesDate->GetValue().c_str());
<br>
if (!f->Load()) {
<br>
delete f;
<br>
continue;
<br>
}
<br>
f->AnonymizeNoLoad();
<br>
f->ClearAnonymizeList();
<br>
/* close the file */
<br>
delete f;
<br>
}
<br>
<br>
-Greg
<br>
<br>
<br>
<br>
<br>
Jean-Pierre Roux wrote:
<br>
<br>
<blockquote type="cite">Jean-Pierre Roux wrote:
<br>
<br>
<blockquote type="cite">Greg Book wrote:
<br>
<br>
<br>
<br>
<blockquote type="cite">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.
<br>
What might be happening?
<br>
</blockquote>
<br>
<br>
<br>
<br>
</blockquote>
--> OK : my answer may look strange
<br>
Please use
<br>
<br>
f->Load()
<br>
juste before using f->AnonymizeNoLoad()
<br>
<br>
This is not a mistake, just a stupid name for AnonymizeNoLoad :
<br>
NoLoad was *not* "don't load the file header", but "don't load the
pixels in memory".
<br>
The right name should be : AnonymizeNoGetData
<br>
<br>
<br>
Jean-Pierre Roux
<br>
<br>
<blockquote type="cite">
<blockquote type="cite">Thanks,
<br>
Greg
<br>
<br>
/* open dicom file */
<br>
f = new gdcm::File();
<br>
f->SetLoadMode(gdcm::LD_ALL);
<br>
f->SetFileName(filelist.Item(i).c_str());
<br>
</blockquote>
<br>
<br>
I'm not on my PC, and I cannot check, but I think you should Load the
gdcm::File here.
<br>
<br>
if ( !f->Load() )
<br>
{
<br>
std::cout << "[" << fileName << "] is not a
gdcm-readable file"
<br>
<< std::endl;
<br>
f->Delete();
<br>
return 1;
<br>
}
<br>
<br>
(Have a look at Example/AnonymizeNoLoad.xx)
<br>
HTH
<br>
Jean-Pierre Roux
<br>
<br>
<br>
<br>
<blockquote type="cite"> /* determine which fields to
anonymize */
<br>
if (chkPatientName->GetValue())
<br>
f->AddAnonymizeElement( 0x0010, 0x0010,
txtPatientName->GetValue().c_str());
<br>
if (chkPatientBirthdate->GetValue())
<br>
f->AddAnonymizeElement( 0x0010, 0x0030,
txtPatientBirthdate->GetValue().c_str());
<br>
if (chkStudyDate->GetValue())
<br>
f->AddAnonymizeElement( 0x0008, 0x0020,
txtStudyDate->GetValue().c_str());
<br>
if (chkSeriesDate->GetValue())
<br>
f->AddAnonymizeElement( 0x0008, 0x0021,
txtSeriesDate->GetValue().c_str());
<br>
/* close the file */
<br>
f->AnonymizeNoLoad();
<br>
f->ClearAnonymizeList();
<br>
delete f;
<br>
<br>
------------------------------------------------------------------------
<br>
<br>
_______________________________________________
<br>
Dcmlib mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Dcmlib@creatis.insa-lyon.fr">Dcmlib@creatis.insa-lyon.fr</a>
<br>
<a class="moz-txt-link-freetext" href="http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib">http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib</a>
<br>
<br>
</blockquote>
<br>
_______________________________________________
<br>
Dcmlib mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Dcmlib@creatis.insa-lyon.fr">Dcmlib@creatis.insa-lyon.fr</a>
<br>
<a class="moz-txt-link-freetext" href="http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib">http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib</a>
<br>
<br>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>