Home Image-Pro Automation (Macros, Apps, Reports)

How to export data from another program (C #) to Image-Pro V10

I want to write the data created by another program (C #) to Image-Pro V10.
Image-Pro Analyzer has a function (IpDocPutArea) for writing data from another program to Image-Pro Analyzer. I want to do the same with Image-Pro V10.

I looked in the forum and found the following URL.

How can I do the contents written in the above URL with another program (C #)? .

Thanks in advance


  • Chono,

    The build-in programming language of Image-Pro 10 workbench is VB.NET. It would be easier to write your code in VB, so you can use the example in the link you've found. There are online code converters that can convert C# code to VB.NET (http://converter.telerik.com/ )

    It is also possible to create external Addins for mage-Pro 10 in any .NET language, including C#. But it's more complicated, and require some additional tools.

  • 2019-10-28-080708

    Chono --

    I do not know how to make DATA from outside of Image-Pro directly accessible to Image-Pro.

    My KISS (Keep It Simple Stupid) solution would be to write the DATA to a DATA FILE on the DISK and have Image-Pro monitor the appropriate location for the appearance of the FILE.  If FILE SHARING is a problem, you can create a second FLAG FILE.  If the FLAG FILE exists, then the DATA SOURCE is in the process of creating the DATA FILE.  When the FLAG FILE disappears, then Image-Pro can READ the DATA FILE.  When Image-Pro is finished, it can delete the DATA FILE and the DATA SOURCE can create the next DATA FILE.

    I hope this information is helpful.

    -- Matt

  • I'm sorry.
    I am not good at writing English. So I seem to have asked a misleading question.

    Let me ask you a question again.

    When you installed Image-Pro V10, a sample program folder was created.
    (C: \ Program Files \ Media Cybernetics \ Image-Pro 10 \ Automation \ Samples \ C #)
    I want to know how to write ushort data to Image-Pro V10 using this sample code.

    I think it is wrong, but I wrote the following code.
    ① Create mciqtGray16 window in Image-Pro v10.
    ② Draw ushort data ("put Data") in this window.


                    object image = null;

                        auto.Application.DocumentCommandClasses.OpenCommand c =


                    ///How should I write here?--->
                    auto.Adjust.ImageCommandClasses.NewCommand n = auto.Adjust.ImageCommands.New(_session);
                    n.DotsPerInchX = 1;
                    n.DotsPerInchY = 1;
                    n.Name = "testImage";
                    n.NumberOfFrames = 1;
                    n.Value = 0;
                    n.Type = IQL.Engine.mcImageQuickTypes.mciqtGray16;
                    n.Height = 1024;
                    n.Width = 1024;
                    n.NumberOfFrames = 1;
                    n.Visible = true;
                    n.Run(ref image);

                    IQL.Engine.McImage test_mcimage = null;
                    ushort[,] putData = new ushort[1024, 1024];
                    putData[3, 3] = 1000;

                    //I want to write ushort putData to "test image".

                    //<---How should I write here?



  • Hi Chono,

    You should use the same code as in the link (you may need to change type to handle 16-bit, e.g. Int16 instead of Byte):

    Public Sub PixelOperationsTestColor()
            Dim im As McImage=ThisApplication.ActiveImage
            If im Is Nothing Then Exit Sub
            If im.NumberOfChannels=1 OrElse im.BitsPerChannel>8 Then Exit Sub'support only 8-bit color image
            'create region access for whole image of color 8-bit image
            Dim ra As McRegionAccess=im.CreateRegionAccess()
            ra.RegionMask=im.Aoi'process only active ROI
            Dim data(,,) As Byte
            'get 3D array of pixel data
            For c As Integer=0 To data.GetUpperBound(0)
                For i As Integer=0 To data.GetUpperBound(1)
                    For j As Integer=0 To data.GetUpperBound(2)
            'put data back
        End Sub

    It can be converted to C#, here is automatically converted code (not tested):

    public void PixelOperationsTestColor()
        McImage im = ThisApplication.ActiveImage;
        if (im == null)
        if (im.NumberOfChannels == 1 || im.BitsPerChannel > 8)
            return;// support only 8-bit color image
                   // create region access for whole image of color 8-bit image
        McRegionAccess ra = im.CreateRegionAccess();
        ra.RegionMask = im.Aoi;// process only active ROI
        byte[,,] data;
        // get 3D array of pixel data
        for (int c = 0; c <= data.GetUpperBound(0); c++)
            for (int i = 0; i <= data.GetUpperBound(1); i++)
                for (int j = 0; j <= data.GetUpperBound(2); j++)
                    // invert
                    data[c, i, j] = 255 - data[c, i, j];
        // put data back

    If you use VB.NET, you don't need external program, you can do everything in the project workbench.

Sign In or Register to comment.