File Comment by Comment
29 Oct 2014 bmorph - binary morphological transforms Fast binary erosion and dilation, with even faster iterative calls. tudor dima

@Hassan
Different results are obtained when different strels are used. Incidentally, this is exactly why this box was built, for the "circular" strel in matlab is actually octagonal. It is stated in the first paragraph of the description.

As for the difference between the matlab dilation/erosion operations and this implementation you could try reading the included .pdf file.

No, I have no suggestions on grayscale morphology.

23 Oct 2014 bmorph - binary morphological transforms Fast binary erosion and dilation, with even faster iterative calls. Hassan Naseri

Thanks for the really fast code.
However, I do not get the expected results as the original imdilate. Would you please tell the difference between the standard dilation/erosion operations and your implementation in terms of functionality?
Another question is that, do you have a speed-up suggestion for grayscale morphology?

29 Jan 2014 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Charaf Eddine SOURIA

Very useful

06 Aug 2013 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. tudor dima

I am not sure I understand the question. The S-parameters are stored as 3D matrices, with the last index spanning the frequency. An N-port at F frequencies will have the size [N N F], that is NxNxF, where N=2 for this 2-port case.

30 Jul 2013 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. padoh

what is meant by 2x2xM matrix? how to write it in matlab?

09 Jul 2013 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included muthu Kumar

25 Jun 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included tudor dima

@Javier
While drawing the initial contour follow the messages in the command window.

At load time (whether from image or .mat file) keep scale depth at 0 if you want to start at the finest resolution. (I suspect you load a ~72x72 array and have kmax set at 3?)

Will look into adding capability to load an initial contour. What is in there already is the ability to save the level-set function and re-use it. (Say once you have input a complicated initialization, you don't want to go through it every time, so you can save it and load it over. However, the image data has to be of the same size.

19 Jun 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Javier

Hi,

another question: when I load a .mat with a double image (the variable is g0 as commented in the code) and then I press "DO Iter" I only see 9 pixels of my image. What can I do?

Thanks

18 Jun 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Javier

Hi,

thanks for sharing the code. I'm having troubles to create a manual initial contour. I select the option Ini. Method "draw" and then I press the button "DO Iter!" but I can't select points with the mouse. What am I doing wrong?

Another question: If I have already the initial contour as a binary mask, can I avoid the function "iniMembrane"?

Thank you very much

25 May 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included tudor dima

Hi, Marcos,

For starters, there is a very short description under Help | Buttons.

You can try the Chan-Vese paper I referenced higher in the abstract (no. [2])

The normalization you mention is done precisely in order to decouple the parameters value from the actual image values (which could come as uint8, uint16, 0-1, or any other data).

24 May 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Marcos Belmonte

Hi,I'm doing my final project of the degree and I haven't a lot of experience so, it's hard for me to follow so much lines of code. I was wondering if you had a paper explaining this guide: the differential equations you employed for the method or something like this. I have proved your method and I really like the results but I want to understand how the parameters affect in order to get better results.

By the way, my images are double and of 16 bits and
approx at lines 840-841 I see:
MaxGVal = max(g(:));
g = g * (255/MaxGVal);

Does it affect my intensity values? It is necessary? Thank you very much!

18 May 2012 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. tudor dima

@Josiah,

It shouldn't... (uses str2num or str2double...)
anyway, could you send me a sample file so I can take a look at it?

17 May 2012 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Josiah Bartlett

I'm finding an issue with SXPWrite.
It does not support or properly truncate scientific notation- a number like -9.8235e-5 ends up being written to the file like -9.8235. This is a HUGE problem! Otherwise a great set of tools.

28 Apr 2012 bmorph - binary morphological transforms Fast binary erosion and dilation, with even faster iterative calls. tudor dima

@Alexander
The structuring element is passed to this function (or to imdilate/imerode, that is).
I am not sure how is it done in Matlab (it's a .mex, twice wrapped :-))

What I suspect it makes the interpreted bmorph to run faster than the MEX is that I do a contour detection on both the image and the strel, then only update those values, the strel is not swept across the whole image.

Until now it only allowed symmetrical strels, but I have recently posted the new version which fixed this. (Thanks to Sean Sklios for the provided test data and also for the push!)

26 Apr 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Marcos Belmonte

You warned me about blank spaces in a previous comment but I forgot it, thanks again.

21 Apr 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included tudor dima

Hi, Marcos
Check if your current location (where you installed this toolbox) contains any spaces. (it happends on Windows, .../My Documents/ ...)
If this is the case try to move it to a space-less location.
If for some reason this isn't possible try this hack, until I post the new version :

Replace line 307 with cd(attData.myData.loc.ImageDir)

12 Apr 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Marcos Belmonte

Hi, thanks for the answer. Now I'm trying to use images as jpg but with the button Load Image File appears immediatly the same error as I posted before, without appearing any menu to select a file. What can be the problem and then, how can I place a circle of the radius I want and where I want for an initial seed?

Thanks

24 Mar 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included tudor dima

@Marcos
This box uses Matlab imread.m, I suspect you could find a Dicom reader on the exchange and either plug it in or convert your images to .jpg, .png, etc.

Be careful with blank spaces in your directory, though, the error above seems to stem from there. I am planning to allow this in a future release.

22 Mar 2012 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Marcos Belmonte

Hi, thanks for sharing your code. I have a problem loading dicom images with Load Image File. First I have run ini.m and then segm_energy_LS, what can be the problem?

??? Error using ==> cd
Too many input arguments.

Error in ==> segm_energy_LS>fLoadData at 307
eval(['cd ' attData.myData.loc.ImageDir])

??? Error while evaluating uimenu Callback

Thanks very much

12 Jan 2012 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Tao Yi Lee

I suggest a minor modification in SXPParse.m for robustness.

At line 55.

% --- find out matrix order ---
[~, NoOfPorts] = strtok(DataFileName, '.');
NoOfPorts = strtok(NoOfPorts, 'p');
NoOfPorts = str2double(NoOfPorts(3:end));

12 Jan 2012 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Tao Yi Lee

08 Dec 2011 bmorph - binary morphological transforms Fast binary erosion and dilation, with even faster iterative calls. Alexander

Great code! Very useful if you don't have the Image Processing Toolbox.

One question: how do you set up the 'circular' structuring element? This seems to be where you get the speed advantage, but I'm not sure how you implement. Thanks.

07 Nov 2011 bmorph - binary morphological transforms Fast binary erosion and dilation, with even faster iterative calls. ssklios Sklios

much faster! This is exactly what I am looking for to use in my image processing code. However, it did not give the same results as imerode for me. Help please?

26 Oct 2011 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. David Yu-Ting Wu

Thank you for saving me from having to write an S2P parser! Truly appreciate it!

30 Sep 2011 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included tudor dima

@Qwuasi Moore - I am not sure I understand what you mean. The evolution rule is solved discreetly using an FD method, I suppose (and this is just a wild guess) that it would be possible to write an FEM solution. I assume you'd encounter similar issues (mainly execution speed, and the infamous convergence issues)

@Pooja
Depending on how your images look like you might want to choose your segmentation method. This one in particular is powerful when dealing with fuzzy and/or incomplete contours, low gradients, etc. (f.i. environments with noise and jitter)

30 Sep 2011 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Pooja

can I use these codes for Brain tumor segmentation?

21 Aug 2011 Image segmentation - multiscale energy-based level sets Segmentation using active contour without edges and multi-scale acceleration. GUI included Qwuasi Moore

Great...Is it possible to do it with FEM?

21 Dec 2010 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. tudor dima

@Matthew
Great to hear that!

Sure, please send the files over and I'll have a look; it was about time I did a revision of the whole box.

14 Dec 2010 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Matthew

Thanks Tudor for writing this very handy toolbox, I have been using it for about a year while I am in grad school and it has saved me a lots of time with its robust handling of Touchstone files (much better and faster than the script I wrote myself) and the handling of singularities in network parameter conversion.

One comment, I have made an alternate version of the s2a and a2s functions which take an optional Zo parameter so that you can have non-unit Zo. In this version Bnew=B*Zo and Cnew=C/Zo in s2a, and it simply reverses these factors in a2s. It is easy to do this external to the function for Y and Z parameters since you just multiply or divide by Zo, but a bit messier to do for ABCD parameters. If you like I can send you the files.

13 Aug 2010 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Andrew Farris

15 Jul 2010 2D histogram - 'exact' and 'fast' binning, 'crop' and 'stretch' grid adjustment 2D histogram of data pairs [x,y]; 'fast'/'exact' binning; 'stretch'/'crop' grid mode. Rhys

Brilliant mfile! I didn't particularly need the 'exact' mode but the function is very easy to use. You have my thanks!

15 Jul 2010 2D histogram - 'exact' and 'fast' binning, 'crop' and 'stretch' grid adjustment 2D histogram of data pairs [x,y]; 'fast'/'exact' binning; 'stretch'/'crop' grid mode. Rhys

12 Jul 2010 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. tudor dima

@Chris
Yes, that's absolutely right.
One note: in case your data is closer to a singularity (for instance during calibrations when data exhibits extremely low or high return losses) then it's a good practice to doublecheck the above using :

a1 = s2a(s1);
a2 = s2a(s2);
s_12_a = a2s(a1*a2);

and then compare the results; (it was not your case, here the maximum delta is 2.2215e-016 -- using max(abs(s_12_a(:)-s(:)))

25 Jun 2010 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. Chris

Would this be the right way to calculate the cascaded input/output VSWR?:

s1 = [148+1.4*1i 193-756*1i; 198-762*1i 119+44*1i]*1e-3;
s2 = [33+68*1i 724-167*1i; 731-166*1i -22+77*1i]*1e-3;

t1 = s2t(s1);
t2 = s2t(s2);

t = t1*t2;
s = t2s(t);

(1+abs(s(1,1)))/(1-abs(s(1,1))) % input VSWR
(1+abs(s(2,2)))/(1-abs(s(2,2))) % output VSWR

Thanks

12 Aug 2009 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. tudor dima

posted the new version that allows more separators and also improves the file parsing speed

@sree kasturi :
thanks for the observation; however, in the absence of noise data the previous version of the function only executed the following two lines, then jumped to end; anyway, I have meanwhile posted the new version and included your suggestion

28 Jul 2009 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files. sree kasturi

to read s2p files without noise data, change line 135 in SXPParse.m to 'while flagNoiseStarted && flagGotOptions'.

24 Sep 2008 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

17 May 2008 2D histogram - 'exact' and 'fast' binning, 'crop' and 'stretch' grid adjustment 2D histogram of data pairs [x,y]; 'fast'/'exact' binning; 'stretch'/'crop' grid mode.

Very good, thank you ! I needed something like this for calculating a fractal dimension, it saved me a lot of time. Thanks again !

15 Dec 2007 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

29 Nov 2007 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

great, thanks; suggestions : smith chart ? circles ?

12 Oct 2007 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

very good; if it had plots it would completely replace my viewer

20 May 2007 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

I wanted to use this to read Agilent PNA .s2p files. However, the sxpparse.m function makes a call to phrase2word.m, which is not included in the toolbox. I found this function on the Exchange. Now, sxpparse hangs up trying to parse the first line of numerical data. The code does not appear to handle cell arrays well. Anyway, it was easier to write my own function than to debug this one.

17 May 2007 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

very good ! ...and very fast :-)

I like especially the singularity-protection, is saves me a lot of hassle from defining quasi-perfect shorts or opens.

BTW, I did not find any files that the parser won't work with. Mind you, we use only HP/Agilent, which is among the orginators of the standard.

02 May 2007 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

the program is exellent but SXPparse function has a problem,once reading the snp file for more than 4 ports(when the sparameter of a frequency is written in more than one single line )the program brakes.

09 Oct 2006 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

Excellent ! we are a few RF designers sharing a single licence of mwoffice and since using this toolbox everything goes smoother - I can get 50-75% of the work done before I fire up the simulator to refine my design. Thanks !

03 Jul 2006 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

nifty ! I like the file import/export operations

06 Oct 2005 input impedance converter : S11, Z, Y (1 complex value) reflection coef. converter: S11 -impedance -admittance -Return Loss -VSWR; graphical & text input

excellent

07 Jun 2005 input impedance converter : S11, Z, Y (1 complex value) reflection coef. converter: S11 -impedance -admittance -Return Loss -VSWR; graphical & text input

does what is says it does, nice and small; for all those times when you don't feel like firing up your simulator to convert a few complex values;...

I would like to be able to switch the grid to smith Z and smith Y

03 Jun 2005 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

it's pretty cool; I like the fact that it's simple and doesn't need 1G of RAM; btw, yes, I tried it in 4.2, it works !

30 Mar 2005 S-parameter toolbox (+ Z, Y, H, G, ABCD, T) Convert between N-port representations of RF circuits. Read / Write industry-standard files.

yes, cascaded simulations will work just fine if you know how to write the individual s-matrices; I hope this will be included in a later release