I am interested to control a number of instruments which has an API written in C# .NET. Based on my experience, if I use IronPython then I can't use python packages like Numpy and Scipy. However, I wanted to see if there is another way to call the .net libraries and be able to use python to implement my control and data analysis algorithms?
Related
We have a console application running in C#, and we need to integrate a groovy script with that. Is there a way to do that? Of course I google it before coming here, and the only useful result I got, it was this one here below:
https://jnbridge.com/blog/groovy-to-net-integration
But we need to use C#, not any external libraries. So, basically what we need a way to integrate a groovy script in our C# code.
Thanks,
take a look at IKVM.NET I do think this is what you are wanting, "IKVM.NET is an implementation of Java for Mono and the Microsoft .NET Framework. IKVM is free software, distributed under a permissive free software license." this allows usage of java to C# bridge and vice versa.
I want to integrate azureml-sdk into some web-page.
But currently I can only find azureml-sdk-for-python.
Is there any release for azureml-sdk-for-dotnet/c-sharp?
Just like https://learn.microsoft.com/en-us/python/api/overview/azure/ml/?view=azure-ml-py
There are only 3 ways to use AzureML:
az ml cli
Python SDK
Microsoft's REST APIs
While working in Dotnet Core, the easiest way is to use the REST APIs, as then you don't need to rely on any package. Also, I believe that the python SDK is using these REST APIs in background. However, the REST APIs don't have the best documentation and its hard to find API params for some specific resources.
Another way would be to use Microsoft.PowerShell.SDK package and then run the az ml cli commands.
Lastly, you can use IronPython package (or something similar) to run the python sdk as well.
You can find documentation for each of the 3 methods here. (Check the "Reference" card on the page)
If you are building a .NET application and want to integrate ML, use ML.NET.
You could find the differences in the document.
I used ImageToVTKImageFilter in C++ application for converting my vtk image to itk.
I wanted to implement this concept in my c# .net application. I used ActiViz.NET for my VTK part.
For ITK in c#, wrapITK, ManagedITK and simpleITK options are available but these are low versions and these are not having ItkVtkGlue.
Question: How do I use ITK or how can I implement ItkVtkGlue in my .NET C# application?
Are there any other options are available to use ITK in C# .NET?
C# is not supported by ITK's wrapping infrastructure, and that has been so for quite a while. A simplified variant of ITK, SimpleITK, has support for C# among other languages.
Edit: Both ITK and SimpleITK have ImportImageFilter. ITKVTKGlue uses that filter internally. Using that filter directly requires more code, but can be done without ITKVTKGlue module.
I have IronPython right now working with PyCharm. Is it possible to import classes from a 3rd party .NET DLL that I have written and get code completion with it?
Currently I'm creating a .NET application where users can upload their Python scripts and interact with the application. Basically I want to create a .NET library that users can import into their Python project and use classes from it with code completion.
Is this possible?
It looks like PyCharm handles Python C extensions by generating a "skeleton" module and using that for completion. The same approach would work for IronPython easily, thanks to .NET reflection, but I don't know if PyCharm supports that sort of extensibility.
I have a c# dll that needs to be called in Java.I see that there is a method using jni to call c++ dlls.How can I do it for a c# dll..Please help..I couldnt find any good material on this
From here:-
IKVM.NET is an implementation of Java for Mono and the Microsoft .NET
Framework. It includes the following components:
A Java Virtual Machine implemented in .NET
A .NET implementation of the Java class libraries
Tools that enable Java and .NET interoperability
You can use Java Native Interface. Or you can create a COM assembly from the C# code and use J-Interop to invoke it.
If you have C# dll sources you need to use maybe the better way will be to translate it to Java using some tools like GrassHopper.
According to GrassHopper key feature explanation it can convert MSIL to Java bite code. So can use without sources of c# dll
Check this: http://www.javonet.com
If you look for quick and easy solution then Javonet should work fine for you. It is light counterpart of IKVM and J-Integra works also as native bridge.
All you have to do is:
add Javonet.jar do your project call
call Javonet.addReference("yourlib.dll")
use your .NET library like it was almost JAVA package
Sample:
NObject obj = Javonet.New("yourDotNetClass");
obj.invoke("YourMethod","arg1", 2);
The syntax is not strongly-typed and works like reflection but gives you fastest access to any custom .NET code, third-party libs or .NET framework as no changes are needed on .NET side. If you need it is also possible to implement custom strongly-typed wrappers.
I do recommend this bridge as in my opinion it is easiest to quickly get things done but also other native bridges are worth checking as this is best approach for such case.
I would avoid going into custom JNI or COM unless you have a lot of time and you just want to learn, if you need quick and reliable solution take one of third-party bridges.