Beispiel #1
0
    public static int Main(string[] args)
    {
        System.Console.WriteLine("Hello World !");
        //gdcm.Reader reader2;
        string filename = args[0];

        System.Console.WriteLine("Reading: " + filename);
        Reader reader = new Reader();

        reader.SetFileName(filename);
        bool ret = reader.Read();

        if (!ret)
        {
            //throw new Exception("Could not read: " + filename );
            return(1);
        }
        //std::cout << reader.GetFile()
        Tag t = new Tag(0x10, 0x10);

        System.Console.WriteLine("out:" + t.toString());
        System.Console.WriteLine("out:" + reader.GetFile().GetDataSet().toString());

        Anonymizer ano = new Anonymizer();

        ano.SetFile(reader.GetFile());
        ano.RemovePrivateTags();
        ano.RemoveGroupLength();
        ano.Replace(t, "GDCM^Csharp^Test^Hello^World");

        Writer writer = new Writer();

        writer.SetFileName("testcs.dcm");
        writer.SetFile(ano.GetFile());
        ret = writer.Write();
        if (!ret)
        {
            //throw new Exception("Could not read: " + filename );
            return(1);
        }

        return(0);
    }
Beispiel #2
0
    public static int Main(string[] args)
    {
        string file1  = args[0];
        string file2  = args[1];
        Reader reader = new Reader();

        reader.SetFileName(file1);
        bool ret = reader.Read();

        if (!ret)
        {
            return(1);
        }

        Anonymizer ano = new Anonymizer();

        ano.SetFile(reader.GetFile());
        ano.RemovePrivateTags();
        ano.RemoveGroupLength();
        Tag t = new Tag(0x10, 0x10);

        ano.Replace(t, "GDCM^Csharp^Test^Hello^World");

        UIDGenerator g = new UIDGenerator();

        ano.Replace(new Tag(0x0008, 0x0018), g.Generate());
        ano.Replace(new Tag(0x0020, 0x000d), g.Generate());
        ano.Replace(new Tag(0x0020, 0x000e), g.Generate());
        ano.Replace(new Tag(0x0020, 0x0052), g.Generate());

        Writer writer = new Writer();

        writer.SetFileName(file2);
        writer.SetFile(ano.GetFile());
        ret = writer.Write();
        if (!ret)
        {
            return(1);
        }

        return(0);
    }
  public static int Main(string[] args)
    {
    System.Console.WriteLine("Hello World !");
    //gdcm.Reader reader2;
    string filename = args[0];
    System.Console.WriteLine( "Reading: " + filename );
    Reader reader = new Reader();
    reader.SetFileName( filename );
    bool ret = reader.Read();
    if( !ret )
      {
      //throw new Exception("Could not read: " + filename );
      return 1;
      }
    //std::cout << reader.GetFile()
    Tag t = new Tag(0x10,0x10);
    System.Console.WriteLine( "out:" + t.toString() );
    System.Console.WriteLine( "out:" + reader.GetFile().GetDataSet().toString() );

    Anonymizer ano = new Anonymizer();
    ano.SetFile( reader.GetFile() );
    ano.RemovePrivateTags();
    ano.RemoveGroupLength();
    ano.Replace( t, "GDCM^Csharp^Test^Hello^World" );

    Writer writer = new Writer();
    writer.SetFileName( "testcs.dcm" );
    writer.SetFile( ano.GetFile() );
    ret = writer.Write();
    if( !ret )
      {
      //throw new Exception("Could not read: " + filename );
      return 1;
      }

    return 0;
    }
Beispiel #4
0
    public static int Main(string[] args)
    {
        string file1 = args[0];
        string file2 = args[1];
        Reader reader = new Reader();
        reader.SetFileName( file1 );
        bool ret = reader.Read();
        if( !ret )
          {
          return 1;
          }

        Anonymizer ano = new Anonymizer();
        ano.SetFile( reader.GetFile() );
        ano.RemovePrivateTags();
        ano.RemoveGroupLength();
        Tag t = new Tag(0x10,0x10);
        ano.Replace( t, "GDCM^Csharp^Test^Hello^World" );

        UIDGenerator g = new UIDGenerator();
        ano.Replace( new Tag(0x0008,0x0018), g.Generate() );
        ano.Replace( new Tag(0x0020,0x000d), g.Generate() );
        ano.Replace( new Tag(0x0020,0x000e), g.Generate() );
        ano.Replace( new Tag(0x0020,0x0052), g.Generate() );

        Writer writer = new Writer();
        writer.SetFileName( file2 );
        writer.SetFile( ano.GetFile() );
        ret = writer.Write();
        if( !ret )
          {
          return 1;
          }

        return 0;
    }