<!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">
gdcm was able to read the DICOM file, but it did not report a problem
and did not write to the file. As of gdcm 1.2, AnonymizeNoLoad() does
not return a value for success or failure. It might be helpful if later
versions of the function return true for success or false if there is
an error.<br>
<br>
Thanks,<br>
Greg<br>
<br>
Mathieu Malaterre wrote:
<blockquote cite="mid455B6D16.7070904@kitware.com" type="cite">Hi Greg,
  <br>
  <br>
    I am not sure I understand. If a DICOM file is mark read only by
the OS, then gdcm will
  <br>
- fail to read the file
  <br>
- fail to report there is a problem ?
  <br>
  <br>
Thanks
  <br>
Mathieu
  <br>
  <br>
Greg Book wrote:
  <br>
  <blockquote type="cite">I got it to work. It turns out the files were
read-only, in Windows XP. Windows doesn't generally complain when you
try to access a read only file. Maybe gdcm2 could give a message if the
file is read-only.
    <br>
    <br>
Thanks,
    <br>
Greg
    <br>
    <br>
    <br>
    <br>
Jean-Pierre Roux wrote:
    <br>
    <blockquote type="cite">Greg Book wrote:
      <br>
      <br>
      <blockquote type="cite">So, I'm still having this problem... Has
anyone seen this problem before? I'm wondering if it's something I'm
doing wrong, or if its a bug? And, if it is a bug, will it be fixed in
version 2.0?
        <br>
        <br>
      </blockquote>
Now, your code looks very much like a copy-paste of 
Example/AnonymizeNoLoad.cxx, and AnonymizeNoLoad seems bug free ...
      <br>
      <br>
Here, we use gdcm1.3, but it worked at gdcm1.2 time (there's an API
breaking modif between 1.2 and 1.3 : we use a reference counting,
therefore, we must write      f = gdcm::File::New( );
      <br>
and
      <br>
f->Delete();
      <br>
instead of
      <br>
f = new gdcm::File();
      <br>
and
      <br>
delete f;
      <br>
      <br>
gdcm2.0  will be something quite different, and was developed by
Mathieu, when he has some time left.
      <br>
No date can be anounced for the first gdcm2 'stable release' (Mathieu :
any comment?)
      <br>
Could you send me one of your files : I would like to check if there is
nothing 'strange' in the header that would break somewhere in gdcm ?
      <br>
Thx
      <br>
Jean-Pierre Roux
      <br>
      <br>
      <blockquote type="cite">Thanks,
        <br>
Greg
        <br>
        <br>
        <br>
        <br>
Greg Book wrote:
        <br>
        <br>
        <blockquote type="cite">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:
          <br>
          <br>
          <blockquote 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>
            <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>
                  <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>
                  <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>
_______________________________________________
                  <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>
------------------------------------------------------------------------
          <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>
        <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>
    </blockquote>
    <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>
  </blockquote>
  <br>
  <br>
</blockquote>
<br>
</body>
</html>