Exemple #1
0
    public static int Main(string[] args)
    {
        gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "My Reformat App" );

        // http://www.oid-info.com/get/1.3.6.1.4.17434
        string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";
        gdcm.UIDGenerator.SetRoot( THERALYS_ORG_ROOT );
        System.Console.WriteLine( "Root dir is now: " + gdcm.UIDGenerator.GetRoot() );

        string filename = args[0];
        string outfilename = args[1];

        Reader reader = new Reader();
        reader.SetFileName( filename );
        if( !reader.Read() )
          {
          System.Console.WriteLine( "Could not read: " + filename );
          return 1;
          }

        UIDGenerator uid = new UIDGenerator(); // helper for uid generation
        FileDerivation fd = new FileDerivation();
        // For the pupose of this execise we will pretend that this image is referencing
        // two source image (we need to generate fake UID for that).
        string ReferencedSOPClassUID = "1.2.840.10008.5.1.4.1.1.7"; // Secondary Capture
        fd.AddReference( ReferencedSOPClassUID, uid.Generate() );
        fd.AddReference( ReferencedSOPClassUID, uid.Generate() );

        // Again for the purpose of the exercise we will pretend that the image is a
        // multiplanar reformat (MPR):
        // CID 7202 Source Image Purposes of Reference
        // {"DCM",121322,"Source image for image processing operation"},
        fd.SetPurposeOfReferenceCodeSequenceCodeValue( 121322 );
        // CID 7203 Image Derivation
        // { "DCM",113072,"Multiplanar reformatting" },
        fd.SetDerivationCodeSequenceCodeValue( 113072 );
        fd.SetFile( reader.GetFile() );
        // If all Code Value are ok the filter will execute properly
        if( !fd.Derive() )
          {
          return 1;
          }

        gdcm.FileMetaInformation fmi = reader.GetFile().GetHeader();
        // The following three lines make sure to regenerate any value:
        fmi.Remove( new gdcm.Tag(0x0002,0x0012) );
        fmi.Remove( new gdcm.Tag(0x0002,0x0013) );
        fmi.Remove( new gdcm.Tag(0x0002,0x0016) );

        Writer writer = new Writer();
        writer.SetFileName( outfilename );
        writer.SetFile( fd.GetFile() );
        if( !writer.Write() )
          {
          System.Console.WriteLine( "Could not write: " + outfilename );
          return 1;
          }

        return 0;
    }
        public async Task <TagType> CreateTagTypeAsync(string name, string description, int minCount, int maxCount)
        {
            try
            {
                var tt = new TagType()
                {
                    Name        = name,
                    Description = description,
                    MinCount    = minCount,
                    MaxCount    = maxCount
                };

                tt.Initialize(UIDGenerator.Next(1));

                await taggerDataContext.TagsRepository.InsertTagTypeAsync(tt);

                await taggerDataContext.SaveChangesAsync();

                return(tt);
            }
            catch (Exception ex)
            {
                //todo log error
                throw;
            }
        }
Exemple #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string name               = txtCusName.Text;
            string surname            = txtCusSurname.Text;
            string contact            = txtCusContact.Text;
            string address            = txtCusAddress.Text;
            string email              = txtCusEmail.Text;
            string activeContract     = "NO";
            string contractExpiration = null;

            Validator v     = new Validator();
            bool      valid = v.VailidateString(name);

            if (valid == true)
            {
                UIDGenerator ug    = new UIDGenerator();
                string       CusID = ug.GenerateCustomerUID(serialClient);
                Client       c     = new Client();

                c.InsertBLCustomer(CusID, name, surname, address, contact, email, activeContract);
                this.Close();
            }
            else
            {
                MessageBox.Show("Please fill in all fields");
            }
        }
Exemple #4
0
        public void RefreshPage() //---------------------------------------------------------------------Page Refresh here
        {
            //Retrieves product Data
            List <Product> productData = new List <Product>();
            BindingSource  bs          = new BindingSource();

            lstProducts.Items.Clear();

            Product pd = new Product();

            productData   = pd.GetBLProduct();
            bs.DataSource = productData;

            dgvProduct.DataSource         = bs;
            dgvProduct.Columns[0].Visible = false;
            dgvProduct.Columns[2].Visible = false;
            dgvProduct.Columns[3].Visible = false;
            dgvProduct.AutoResizeColumns();


            //Retrieves Configuration Data

            List <Configuration> confData = new List <Configuration>();
            BindingSource        bsConf   = new BindingSource();

            lstConfiguration.Items.Clear();

            Configuration c = new Configuration();

            confData          = c.GetBLConfiguration();
            bsConf.DataSource = confData;

            dgvConfiguration.DataSource         = bsConf;
            dgvConfiguration.Columns[0].Visible = false;
            dgvConfiguration.Columns[2].Visible = false;

            //Retrieves Client Data

            List <Client> clientData = new List <Client>();

            Client client = new Client();

            clientData = client.GetCustomer();
            dgvCustomers.DataSource = clientData;
            dgvCustomers.AutoResizeColumns();
            dgvCustomers.Columns[0].Visible = false;
            dgvCustomers.Columns[3].Visible = false;
            dgvCustomers.Columns[4].Visible = false;
            dgvCustomers.Columns[5].Visible = false;
            dgvCustomers.Columns[6].Visible = false;
            dgvCustomers.Columns[7].Visible = false;

            //Retrieves ClientUID

            int          clientSerial = dgvCustomers.RowCount + 1;
            UIDGenerator g            = new UIDGenerator();

            clientID = g.GenerateCustomerUID(clientSerial);
        }
Exemple #5
0
        /// <summary>
        /// 创建一个关联到指定数据库连接的Storage
        /// </summary>
        /// <param name="conn">关联的数据库</param>
        public StorageBase(SQLiteConnection conn)
        {
            _database = conn;
            SQLiteCommand cmd = new SQLiteCommand(conn);

            _filterUIDGenerator    = new UIDGenerator(GetInitUID(cmd, APM.FilterUID, APM.FiltersTable));
            _containerUIDGenerator = new UIDGenerator(GetInitUID(cmd, APM.ContainerUID, APM.ContainersTable));
        }
Exemple #6
0
 public async Task <int> UpdateOrderAsync(Order order)
 {
     if (order.OrderID > 0)
     {
         _dataSource.Entry(order).State = EntityState.Modified;
     }
     else
     {
         order.OrderID   = UIDGenerator.Next(4);
         order.OrderDate = DateTime.UtcNow;
         _dataSource.Entry(order).State = EntityState.Added;
     }
     order.LastModifiedOn = DateTime.UtcNow;
     order.SearchTerms    = order.BuildSearchTerms();
     return(await _dataSource.SaveChangesAsync());
 }
 public async Task <int> UpdateProductAsync(Product product)
 {
     if (!String.IsNullOrEmpty(product.ProductID))
     {
         _dataSource.Entry(product).State = EntityState.Modified;
     }
     else
     {
         product.ProductID = UIDGenerator.Next(6).ToString();
         product.CreatedOn = DateTime.UtcNow;
         _dataSource.Entry(product).State = EntityState.Added;
     }
     product.LastModifiedOn = DateTime.UtcNow;
     product.SearchTerms    = product.BuildSearchTerms();
     return(await _dataSource.SaveChangesAsync());
 }
 public async Task<int> UpdateCustomerAsync(Customer customer)
 {
     if (customer.CustomerID > 0)
     {
         _dataSource.Entry(customer).State = EntityState.Modified;
     }
     else
     {
         customer.CustomerID = UIDGenerator.Next();
         customer.CreatedOn = DateTime.UtcNow;
         _dataSource.Entry(customer).State = EntityState.Added;
     }
     customer.LastModifiedOn = DateTime.UtcNow;
     customer.SearchTerms = customer.BuildSearchTerms();
     int res = await _dataSource.SaveChangesAsync();
     return res;
 }
Exemple #9
0
 public async Task <int> UpdateOrderAsync(Order order)
 {
     if (order.order_id > 0)
     {
         _dataSource.Entry(order).State = EntityState.Modified;
     }
     else
     {
         order.order_id = UIDGenerator.Next(4);
         order.order_dt = DateTime.UtcNow;
         order.reg_dt   = DateTime.UtcNow;
         _dataSource.Entry(order).State = EntityState.Added;
     }
     order.upd_dt      = DateTime.UtcNow;
     order.searchterms = order.BuildSearchTerms();
     return(await _dataSource.SaveChangesAsync());
 }
        public async Task <int> UpdateCustomerAsync(Customer customer)
        {
            if (customer.customer_id > 0)
            {
                _dataSource.Entry(customer).State = EntityState.Modified;
            }
            else
            {
                customer.customer_id = UIDGenerator.Next();
                customer.reg_dt      = DateTime.UtcNow;
                _dataSource.Entry(customer).State = EntityState.Added;
            }
            customer.upd_dt      = DateTime.UtcNow;
            customer.searchterms = customer.BuildSearchTerms();
            int res = await _dataSource.SaveChangesAsync();

            return(res);
        }
        public async Task <int> UpdatePlaceAsync(Place place)
        {
            if (place.place_id > 0)
            {
                _dataSource.Entry(place).State = EntityState.Modified;
            }
            else
            {
                place.place_id = UIDGenerator.Next();
                place.reg_dt   = DateTime.UtcNow;
                _dataSource.Entry(place).State = EntityState.Added;
            }
            place.upd_dt      = DateTime.UtcNow;
            place.searchterms = place.BuildSearchTerms();
            int res = await _dataSource.SaveChangesAsync();

            return(res);
        }
Exemple #12
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);
    }
Exemple #13
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            int    serial      = int.Parse(lblSerial.Text);
            string name        = txtName.Text;
            string description = rtbDescription.Text;
            string yearModel   = txtYearModel.Text;
            string price       = txtPrice.Text;
            string manu        = null;

            if (cmbManu.Text.ToLower() == "securetech")
            {
                manu = "M";
            }
            if (cmbManu.Text.ToLower() == "heatdetectives")
            {
                manu = "N";
            }
            if (cmbManu.Text.ToLower() == "opticaldocters")
            {
                manu = "O";
            }
            if (cmbManu.Text.ToLower() == "easytech")
            {
                manu = "P";
            }
            if (cmbManu.Text.ToLower() == "futuresecure")
            {
                manu = "R";
            }

            UIDGenerator gen = new UIDGenerator();

            string productUID = gen.GenerateProductUID(serial, manu, yearModel);

            Product p = new Product();

            p.InsertBLProduct(productUID, name, description, yearModel, price);

            this.Close();
        }
Exemple #14
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)
    {
    string file1 = args[0];
    Mpeg2VideoInfo info = new Mpeg2VideoInfo(file1);
    System.Console.WriteLine( info.StartTime );
    System.Console.WriteLine( info.EndTime );
    System.Console.WriteLine( info.Duration );
    System.Console.WriteLine( info.AspectRatio );
    System.Console.WriteLine( info.FrameRate );
    System.Console.WriteLine( info.PictureWidth );
    System.Console.WriteLine( info.PictureHeight );

    ImageReader r = new ImageReader();
    //Image image = new Image();
    Image image = r.GetImage();
    image.SetNumberOfDimensions( 3 );
    DataElement pixeldata = new DataElement( new gdcm.Tag(0x7fe0,0x0010) );

    System.IO.FileStream infile =
      new System.IO.FileStream(file1, System.IO.FileMode.Open, System.IO.FileAccess.Read);
    uint fsize = gdcm.PosixEmulation.FileSize(file1);

    byte[] jstream  = new byte[fsize];
    infile.Read(jstream, 0 , jstream.Length);

    SmartPtrFrag sq = SequenceOfFragments.New();
    Fragment frag = new Fragment();
    frag.SetByteValue( jstream, new gdcm.VL( (uint)jstream.Length) );
    sq.AddFragment( frag );
    pixeldata.SetValue( sq.__ref__() );

    // insert:
    image.SetDataElement( pixeldata );

    PhotometricInterpretation pi = new PhotometricInterpretation( PhotometricInterpretation.PIType.YBR_PARTIAL_420 );
    image.SetPhotometricInterpretation( pi );
    // FIXME hardcoded:
    PixelFormat pixeltype = new PixelFormat(3,8,8,7);
    image.SetPixelFormat( pixeltype );

    // FIXME hardcoded:
    TransferSyntax ts = new TransferSyntax( TransferSyntax.TSType.MPEG2MainProfile);
    image.SetTransferSyntax( ts );

    image.SetDimension(0, (uint)info.PictureWidth);
    image.SetDimension(1, (uint)info.PictureHeight);
    image.SetDimension(2, 721);

    ImageWriter writer = new ImageWriter();
    gdcm.File file = writer.GetFile();
    file.GetHeader().SetDataSetTransferSyntax( ts );
    Anonymizer anon = new Anonymizer();
    anon.SetFile( file );

    MediaStorage ms = new MediaStorage( MediaStorage.MSType.VideoEndoscopicImageStorage);

    UIDGenerator gen = new UIDGenerator();
    anon.Replace( new Tag(0x0008,0x16), ms.GetString() );
    anon.Replace( new Tag(0x0018,0x40), "25" );
    anon.Replace( new Tag(0x0018,0x1063), "40.000000" );
    anon.Replace( new Tag(0x0028,0x34), "4\\3" );
    anon.Replace( new Tag(0x0028,0x2110), "01" );

    writer.SetImage( image );
    writer.SetFileName( "dummy.dcm" );
    if( !writer.Write() )
      {
      System.Console.WriteLine( "Could not write" );
      return 1;
      }

    return 0;
    }
Exemple #16
0
    public static int Main(string[] args)
    {
        gdcm.FileMetaInformation.SetSourceApplicationEntityTitle("My Reformat App");

        // http://www.oid-info.com/get/1.3.6.1.4.17434
        string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";

        gdcm.UIDGenerator.SetRoot(THERALYS_ORG_ROOT);
        System.Console.WriteLine("Root dir is now: " + gdcm.UIDGenerator.GetRoot());

        string filename    = args[0];
        string outfilename = args[1];

        Reader reader = new Reader();

        reader.SetFileName(filename);
        if (!reader.Read())
        {
            System.Console.WriteLine("Could not read: " + filename);
            return(1);
        }

        UIDGenerator   uid = new UIDGenerator(); // helper for uid generation
        FileDerivation fd  = new FileDerivation();
        // For the pupose of this execise we will pretend that this image is referencing
        // two source image (we need to generate fake UID for that).
        string ReferencedSOPClassUID = "1.2.840.10008.5.1.4.1.1.7"; // Secondary Capture

        fd.AddReference(ReferencedSOPClassUID, uid.Generate());
        fd.AddReference(ReferencedSOPClassUID, uid.Generate());

        // Again for the purpose of the exercise we will pretend that the image is a
        // multiplanar reformat (MPR):
        // CID 7202 Source Image Purposes of Reference
        // {"DCM",121322,"Source image for image processing operation"},
        fd.SetPurposeOfReferenceCodeSequenceCodeValue(121322);
        // CID 7203 Image Derivation
        // { "DCM",113072,"Multiplanar reformatting" },
        fd.SetDerivationCodeSequenceCodeValue(113072);
        fd.SetFile(reader.GetFile());
        // If all Code Value are ok the filter will execute properly
        if (!fd.Derive())
        {
            return(1);
        }

        gdcm.FileMetaInformation fmi = reader.GetFile().GetHeader();
        // The following three lines make sure to regenerate any value:
        fmi.Remove(new gdcm.Tag(0x0002, 0x0012));
        fmi.Remove(new gdcm.Tag(0x0002, 0x0013));
        fmi.Remove(new gdcm.Tag(0x0002, 0x0016));

        Writer writer = new Writer();

        writer.SetFileName(outfilename);
        writer.SetFile(fd.GetFile());
        if (!writer.Write())
        {
            System.Console.WriteLine("Could not write: " + outfilename);
            return(1);
        }


        return(0);
    }
Exemple #17
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            bool   dgvValidator     = false;
            string customerUID      = null;
            string customerName     = null;
            string customerSurname  = null;
            string customerAddress  = null;
            string activeContract   = null;
            string expirationDate   = null;
            string contractName     = null;
            string monthlyPrice     = null;
            string contractTerm     = null;
            string products         = null;
            string representedSChar = null;
            string serviceName      = null;
            string maintenancePlan  = null;
            string servicePrice     = null;
            string installationDate = null;
            string representedCChar = null;

            if (dgvClients.SelectedCells.Count > 0)
            {
                int             selectedrowindex = dgvClients.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow      = dgvClients.Rows[selectedrowindex];
                customerUID     = Convert.ToString(selectedRow.Cells["ClientID"].Value);
                customerName    = Convert.ToString(selectedRow.Cells["Name"].Value);
                customerSurname = Convert.ToString(selectedRow.Cells["Surname"].Value);
                customerAddress = Convert.ToString(selectedRow.Cells["Address"].Value);
                activeContract  = Convert.ToString(selectedRow.Cells["ActiveContract"].Value);
                expirationDate  = Convert.ToString(selectedRow.Cells["ContractExpiration"].Value);
            }
            else
            {
                dgvValidator = true;
            }
            if (dgvContractTypes.SelectedCells.Count > 0)
            {
                int             selectedrowindex = dgvContractTypes.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow      = dgvContractTypes.Rows[selectedrowindex];
                contractName     = Convert.ToString(selectedRow.Cells["ContractName"].Value);
                monthlyPrice     = Convert.ToString(selectedRow.Cells["MonthlyPrice"].Value);
                contractTerm     = Convert.ToString(selectedRow.Cells["ContractTerm"].Value);
                products         = Convert.ToString(selectedRow.Cells["Products"].Value);
                representedCChar = Convert.ToString(selectedRow.Cells["RepresentedChar"].Value);
            }
            else
            {
                dgvValidator = true;
            }
            if (dgvServices.SelectedCells.Count > 0)
            {
                int             selectedrowindex = dgvServices.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow      = dgvServices.Rows[selectedrowindex];
                serviceName      = Convert.ToString(selectedRow.Cells["ServiceName"].Value);
                maintenancePlan  = Convert.ToString(selectedRow.Cells["MaintenancePlan"].Value);
                servicePrice     = Convert.ToString(selectedRow.Cells["ServicePrice"].Value);
                installationDate = Convert.ToString(selectedRow.Cells["installationDate"].Value);
                representedSChar = Convert.ToString(selectedRow.Cells["RepresentedChar"].Value);
            }
            else
            {
                dgvValidator = true;
            }

            if (dgvValidator == true)
            {
                MessageBox.Show("Please select all values that should be included in Contract!");
            }
            else
            {
                DateTime dateInstalled = new DateTime();

                dateInstalled = dtpInstallationdate.Value;

                UIDGenerator ug = new UIDGenerator();

                if (activeContract[0] == 'N')
                {
                    char termChar   = contractTerm[0];
                    int  termAmount = termChar - '0';

                    string newExpirationDate = dateInstalled.AddYears(termAmount).ToString("dd/MM/yyyy");

                    string contractUID = ug.GenerateContractUID(representedCChar, representedSChar, serial, dateInstalled);


                    ContractRapportForm crf = new ContractRapportForm();
                    crf.ObtainContractDetails(contractUID, contractName, contractTerm, products, serviceName, dateInstalled.ToString("dd/MM/yyyy"), newExpirationDate, maintenancePlan, monthlyPrice, servicePrice, customerName, customerSurname, customerAddress, customerUID);
                    crf.Show();
                    crf.FormClosed += new FormClosedEventHandler(child_FormClosed);
                }
                else
                {
                    DialogResult dialogResult = MessageBox.Show(@"You can only have one active contract at a time !
Would u like add this contract on a future period ?", "Active Contract", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        dateInstalled = DateTime.Parse(expirationDate).AddDays(1);
                        char   termChar          = contractTerm[0];
                        int    termAmount        = termChar - '0';
                        string newExpirationDate = dateInstalled.AddYears(termAmount).ToString("dd/MM/yyyy");

                        string contractUID      = ug.GenerateContractUID(representedCChar, representedSChar, serial, dateInstalled);
                        ContractRapportForm crf = new ContractRapportForm();
                        crf.ObtainContractDetails(contractUID, contractName, contractTerm, products, serviceName, dateInstalled.ToString("dd/MM/yyyy"), newExpirationDate, maintenancePlan, monthlyPrice, servicePrice, customerName, customerSurname, customerAddress, customerUID);

                        crf.Show();
                        crf.FormClosed += new FormClosedEventHandler(child_FormClosed);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                    }
                }
            }
        }
Exemple #18
0
    public static int Main(string[] args)
    {
        string         file1 = args[0];
        Mpeg2VideoInfo info  = new Mpeg2VideoInfo(file1);

        System.Console.WriteLine(info.StartTime);
        System.Console.WriteLine(info.EndTime);
        System.Console.WriteLine(info.Duration);
        System.Console.WriteLine(info.AspectRatio);
        System.Console.WriteLine(info.FrameRate);
        System.Console.WriteLine(info.PictureWidth);
        System.Console.WriteLine(info.PictureHeight);

        ImageReader r = new ImageReader();
        //Image image = new Image();
        Image image = r.GetImage();

        image.SetNumberOfDimensions(3);
        DataElement pixeldata = new DataElement(new gdcm.Tag(0x7fe0, 0x0010));

        System.IO.FileStream infile =
            new System.IO.FileStream(file1, System.IO.FileMode.Open, System.IO.FileAccess.Read);
        uint fsize = gdcm.PosixEmulation.FileSize(file1);

        byte[] jstream = new byte[fsize];
        infile.Read(jstream, 0, jstream.Length);

        SmartPtrFrag sq   = SequenceOfFragments.New();
        Fragment     frag = new Fragment();

        frag.SetByteValue(jstream, new gdcm.VL((uint)jstream.Length));
        sq.AddFragment(frag);
        pixeldata.SetValue(sq.__ref__());

        // insert:
        image.SetDataElement(pixeldata);

        PhotometricInterpretation pi = new PhotometricInterpretation(PhotometricInterpretation.PIType.YBR_PARTIAL_420);

        image.SetPhotometricInterpretation(pi);
        // FIXME hardcoded:
        PixelFormat pixeltype = new PixelFormat(3, 8, 8, 7);

        image.SetPixelFormat(pixeltype);

        // FIXME hardcoded:
        TransferSyntax ts = new TransferSyntax(TransferSyntax.TSType.MPEG2MainProfile);

        image.SetTransferSyntax(ts);

        image.SetDimension(0, (uint)info.PictureWidth);
        image.SetDimension(1, (uint)info.PictureHeight);
        image.SetDimension(2, 721);

        ImageWriter writer = new ImageWriter();

        gdcm.File file = writer.GetFile();
        file.GetHeader().SetDataSetTransferSyntax(ts);
        Anonymizer anon = new Anonymizer();

        anon.SetFile(file);

        MediaStorage ms = new MediaStorage(MediaStorage.MSType.VideoEndoscopicImageStorage);

        UIDGenerator gen = new UIDGenerator();

        anon.Replace(new Tag(0x0008, 0x16), ms.GetString());
        anon.Replace(new Tag(0x0018, 0x40), "25");
        anon.Replace(new Tag(0x0018, 0x1063), "40.000000");
        anon.Replace(new Tag(0x0028, 0x34), "4\\3");
        anon.Replace(new Tag(0x0028, 0x2110), "01");

        writer.SetImage(image);
        writer.SetFileName("dummy.dcm");
        if (!writer.Write())
        {
            System.Console.WriteLine("Could not write");
            return(1);
        }

        return(0);
    }