matlab Archives - Todd McCollough's Website https://www.toddmccollough.com/tag/matlab/ Todd McCollough's Website Tue, 16 Jan 2018 16:56:11 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.1 https://www.toddmccollough.com/wp-content/uploads/2021/05/cropped-todd_mccollough_logo_125_125-32x32.png matlab Archives - Todd McCollough's Website https://www.toddmccollough.com/tag/matlab/ 32 32 Microwave Imaging Device Patent Named Co-Inventor on Assigned to Ellumen Inc. https://www.toddmccollough.com/microwave-imaging-device-patent-named-co-inventor-on-assigned-to-ellumen-inc/ https://www.toddmccollough.com/microwave-imaging-device-patent-named-co-inventor-on-assigned-to-ellumen-inc/#comments Tue, 16 Jan 2018 16:56:11 +0000 http://www.toddmccollough.com/?p=1226 During my work with the Celadon Research Division of Ellumen Inc., I was a co-inventor on a patent titled “Microwave Imaging Device” that recently issued on January 16, 2018. This […]

The post Microwave Imaging Device Patent Named Co-Inventor on Assigned to Ellumen Inc. appeared first on Todd McCollough's Website.

]]>
During my work with the Celadon Research Division of Ellumen Inc., I was a co-inventor on a patent titled “Microwave Imaging Device” that recently issued on January 16, 2018. This is the fourth patent I have been a co-inventor on. If you are looking for more details of my prior three patents see the post titled “Description of Three Patents Named Co-Inventor On Assigned to Ellumen Inc.” All of these patents were granted by the United States Patent and Trademark Office (USPTO) and currently assigned to Ellumen Inc. I wanted to describe more of the details of the “Microwave Imaging Device” patent.

The “Microwave Imaging Device” patent resulted from wanting an automatic way to acquire microwave imaging data pertaining to some object and/or body part from both a movable transmitting and receiving antenna. In addition, there was desire to be able to collect not just 2D data but also 3D data and also acquire the surface information of what was placed inside the scanner. To accomplish this, a system was built that: 1) contained an object support to hold an object on, 2) contained a transmitter antenna, 3) contained a receiver antenna, 4) had both an inner and outer ring where either the transmitter or receiver was mounted on, 5) contained a controller to independently rotate both the inner and outer ring, 6) contained a computation processor to receive the collected data, and in one embodiment 7) contained a controller to move the object support up and down, and 8) contained an object surface position sensor mounted to either the inner or outer ring to collect the surface of the object. It is important to note that the inner and outer ring are concentric to each other but have different radii. In some embodiments, gears, pinions, and motors are used to help rotate the inner and outer rings, while a feedback monitor can determine if any potential mismatch in positioning occurs. The system further allows for the object surface position data to be used as a seed in the reconstruction of an image represented in dielectric values. In one embodiment, stored data of a prior image reconstruction that closely matches data of the object is used in combination with surface position data as a seed in the reconstruction. The patent also allows for the transmitter and receiver antenna to be mounted in such a way that they can radially translate to and from the center of the device. In addition, the patent covers some aspects of the controller and its module including positions to move both the transmitter and receiver antenna to, the names and locations of the collected data for storage, any necessary instrument parameters, and a calibration of the initial positions of the transmitter and receiver antenna.

The Celadon Research Division of Ellumen Inc. built a prototype of the robotic microwave imaging device as described in the patent that communicates with laboratory instruments (arbitrary waveform generator, oscilloscope, and vector network analyzer) and an infrared sensor and acquires data at different positions for the transmitting and receiving antenna and sensor. I helped program instrument commands to talk to the laboratory instruments using Virtual Instrument Software Architecture (VISA) to automatically acquire data. I collaborated on development of the graphical user interface (GUI) using VB.NET, MATLAB, and a dynamic-link library (DLL). The device can collect data in both the time and frequency domains and be operated remotely with monitoring by a camera. I helped collect data and programmed code to process the data including quickly loading in many data sets, plotting the data, performing analysis, and performing surface reconstruction. I also helped program and generate image reconstruction results from the data collected by the device. The Celadon Research Division of Ellumen Inc., presented a discussion of the device and imaging results in the journal publication IEEE Transactions on Microwave Theory and Techniques and at the IEEE AP-S Symposium on Antennas and Propagation and USNC-URSI Radio Science Meeting in San Diego, CA, in July 2017. See the paper titled “A Phase Confocal Method for Near-Field Microwave Imaging” and the paper of the poster presentation titled “Experimental Microwave Near-field Detection with Moveable Antennas” for some additional details. I was a co-author on the published paper and helped participate in the presentation. A few photos from the conference in San Diego were previously published in the post titled “IEEE AP-S Symposium on Antennas and Propagation and USNC-URSI Radio Science Meeting in San Diego, CA, in July 2017.”

It is exciting to work on new technology and devices that can have a real impact on the health of patients. Below is a patent certificate that was created to celebrate the accomplishment of having the patent granted.

Microwave Imaging Device Patent

The post Microwave Imaging Device Patent Named Co-Inventor on Assigned to Ellumen Inc. appeared first on Todd McCollough's Website.

]]>
https://www.toddmccollough.com/microwave-imaging-device-patent-named-co-inventor-on-assigned-to-ellumen-inc/feed/ 4
How to write a .dll file in Windows 32 bit and 64 bit and Compile in Matlab 32 bit and 64 bit and how to write a .so file in Ubuntu (Linux) and Compile in 64 bit Matlab https://www.toddmccollough.com/how-to-write-a-dll-file-in-windows-32-bit-64-bit-and-compile-in-matlab-and-how-to-write-a-so-file-in-ubuntu-linux-and-compile-in-matlab/ https://www.toddmccollough.com/how-to-write-a-dll-file-in-windows-32-bit-64-bit-and-compile-in-matlab-and-how-to-write-a-so-file-in-ubuntu-linux-and-compile-in-matlab/#comments Fri, 25 Dec 2009 02:30:18 +0000 http://www.toddmccollough.com/?p=98 I have spent a significant amount of time attempting to write a dll in C/C++ and call it in Matlab. An article was previously written on this topic at http://guoliangye.com/2009/01/21/how-to-write-a-dll-in-cc-and-call-it-in-matlab/ (link […]

The post How to write a .dll file in Windows 32 bit and 64 bit and Compile in Matlab 32 bit and 64 bit and how to write a .so file in Ubuntu (Linux) and Compile in 64 bit Matlab appeared first on Todd McCollough's Website.

]]>
I have spent a significant amount of time attempting to write a dll in C/C++ and call it in Matlab. An article was previously written on this topic at http://guoliangye.com/2009/01/21/how-to-write-a-dll-in-cc-and-call-it-in-matlab/ (link no longer working as of 2018) but I feel the need to discuss it further in both the Windows and Linux environments.

In Windows 32 bit with 32 bit MATLAB.

1) Create two files named Test.h and Test.cpp

Test.h

#ifndef MY_API
#define MY_API extern “C” __declspec(dllexport)
#endif
MY_API int add(int a, int b);
MY_API int sub(int a, int b);

Test.cpp

#ifndef MY_API
#define MY_API extern “C” __declspec(dllexport)
#endif
#include “Test.h”
int add(int a,int b)
{
return a + b;
}
int sub(int a,int b)
{
return a – b;
}

2) Compile into a DLL (.dll) file using Visual Studio 2008 Professional or Express Edition. If neither is installed, you will need to download and install. Check the MATLAB documentation to see the list of all of the supported compilers for your version of MATLAB .

Step by step instructions for creating a .dll using Visual Studio can be found at http://msdn.microsoft.com/en-us/library/ms235636(VS.80).aspx

3) You then need to copy the newly created .dll file along with the original .h file to a MATLAB directory search path or you can just include the call to the directory.

Now open MATLAB and type

loadlibrary(‘Test.dll’, ‘Test.h’);

4) You can view the newly loaded function using

libfunctionsview Test;

5) You can also call the functions such as

A = calllib(‘Test’,’add’,5,4);
B = calllib(‘Test’,’sub’,5,4);

6) You can also unload the library using

unloadlibrary Test

In Windows 64 bit with 64 bit MATLAB.

Getting the dll file to compile in the 64 bit Windows version is a bit more tricky. MATLAB wants a C file not a C++ file. So one needs to be careful.

1) Create two files named Test.h and Test.c

Test.h

int sum(int, int);

Test.c

__declspec(dllexport) int sum(int a, int b)
{
return a + b;
}

NOTE: A “.c” file is not a selectable file type in Visual Studio 2008 so you may have to manually enter the file extension. You can select a .cpp file when adding to your project, but make sure to call it ‘Test.c’ so that .cpp is not the extension.

2) Compile into a DLL (.dll) file using Visual Studio 2008 Professional SP1.  Check the MATLAB documentation to see the list of all of the supported compilers for your version of MATLAB .

Step by step instructions for creating a .dll using Visual Studio can be found at http://msdn.microsoft.com/en-us/library/ms235636(VS.80).aspx

However, you need to be careful here. Before building the dll you need to go into properities and then the configuration manager and then choose a new active solution platform. Then you need to select ‘x64’ copy the settings for win32 and click OK.

Now you may or may not see x64. By default the x64 compiler is not installed during the install of Microsoft Visual Studio 2008 Pro. You will need to select it or just choose the full install. Even doing this I had an issue where it would not show up unless I also installed SP1. So make sure you install SP1 and select the x64 compilers if you do not do a full install, they are not default.

These instructions go into more details on getting a x64 .dll to work http://msdn.microsoft.com/en-us/library/9yb4317s.aspx.

3) You then need to copy the newly created .dll file along with the original .h file to a MATLAB directory search path or you can just include the call to the directory.

Now open MATLAB and type

loadlibrary(‘Test.dll’, ‘Test.h’);

4) You can view the newly loaded function using

libfunctionsview Test;

5) You can also call the functions such as

C = calllib(‘Test’,’sum’,5,4);

6) You can also unload the library using

unloadlibrary Test

In Linux 64 bit with 64 bit MATLAB.

1) Create two files named Test.h and Test.c

Test.h

int add(int a, int b);
int sub(int a, int b);

Test.c

#include “Test.h”
int add(int a,int b)
{
return a + b;
}
int sub(int a,int b)
{
return a – b;
}

NOTE: An extra return should be added to the end of both of these files.

2) You will want to open up the Terminal. Then you will want to enter

sudo apt-get install build-essential

This will install gcc/gcc++ which will be needed to compile.

You will be compiling into a .so file. To do this make sure the two files you created in (1) are located in your username directory, if not copy them there. Then in the terminal type the following

gcc -c -fPIC Test.c -o Test.o
gcc -shared -Wl,-soname,Test.so.1 -o Test.so Test.o

3) You then need to copy the newly created .so file along with the original .h file to a MATLAB directory search path or you can just include the call to the directory.

Now open MATLAB and type

loadlibrary(‘/home/username/Test’,’/home/username/Test.h’)

Where username is the username you are on your Linux Install.

4) You can view the newly loaded function using

libfunctionsview Test;

5) You can also call the functions such as

A = calllib(‘Test’,’add’,5,4);
B = calllib(‘Test’,’sub’,5,4);

6) You can also unload the library using

unloadlibrary Test

NOTE:

The above was originally run and tested in December 2009 on a computer running Windows XP 32 bit and  MATLAB 2009 B 32 bit version,  on a computer running Windows 7 64 bit and MATLAB 2009 B 64 bit, and on a computer running Ubuntu 9.04 64 bit computer running MATLAB 2009 A 64 bit version.

This was also tested in November 2010 as an update on a computer running Ubuntu 10.10 64 bit with MATLAB 2010 B 64 bit version.

Refer to the latest MATLAB documentation for updates and what compiler you will need.

MATLAB documentation provides further information of using C shared libraries in MATLAB.

Further you may encounter errors relating to copying and pasting the above directly into files. Therefore I encourage you to directly type out all the files and commands.

The post How to write a .dll file in Windows 32 bit and 64 bit and Compile in Matlab 32 bit and 64 bit and how to write a .so file in Ubuntu (Linux) and Compile in 64 bit Matlab appeared first on Todd McCollough's Website.

]]>
https://www.toddmccollough.com/how-to-write-a-dll-file-in-windows-32-bit-64-bit-and-compile-in-matlab-and-how-to-write-a-so-file-in-ubuntu-linux-and-compile-in-matlab/feed/ 11