How to export data from 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.
URL:
https://forums.mediacy.com/discussion/395/pixel-level-manipulation-too-slow-and-needs-to-work-on-larger-image
How can I do the contents written in the above URL with another program (C #)? .
Answers
-
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.
Yuri0 -
2019-10-28-080708Chono --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
0 -
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 =auto.Application.DocumentCommands.Open(_session);
}{
///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?
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 -
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 ra.GetArea(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) 'invert data(c,i,j)=255-data(c,i,j) Next Next Next 'put data back ra.PutArea(data) 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)return;if (im.NumberOfChannels == 1 || im.BitsPerChannel > 8)return;// support only 8-bit color image// create region access for whole image of color 8-bit imageMcRegionAccess ra = im.CreateRegionAccess();ra.RegionMask = im.Aoi;// process only active ROIbyte[,,] data;// get 3D array of pixel datara.GetArea(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++)// invertdata[c, i, j] = 255 - data[c, i, j];}}// put data backra.PutArea(data);}
If you use VB.NET, you don't need external program, you can do everything in the project workbench.
Yuri0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions