Release of G'MIC 2.8

David,

here is a custom command (from you)

gmic help linear_reg,0

[gmic] Command ‘linear_reg’ has no description (did you mean ‘linear_x3’ ?). Try ‘gmic -h’ for global help.

#@cli linear_reg :
#@cli : The idea is to build the system [X,1].[a;b] = [Y], where X and Y are the column vectors
#@cli : composed of the values of images X and Y you want to match, and [a;b] the vector of the
#@cli : coefficients you are looking for.
#@cli : This small piece of code compute a and b for two input images [0] = X and [1] = Y such
#@cli : that ||Y - (a.X + b)||^2 is minimum:
linear_reg :
–l
-y 1,100%,1,1,1
-a[0,-1] x
-r 100%,{min(h,10000)}
-solve. [-2]
-k. a={[0]} b={[1]} -rm
-endl # Get vector [a,b]
–*[0] $a -+. $b # Compute [2] = aX+b (should match [1]).

I have put it into a file, say exa.gmic

And …

gmic m exa.gmic osteo follic r. … linear_reg
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Import commands from file ‘exa.gmic’ (1 new, total: 4203).
[gmic]-0./ Load osteoblast nucleus example image
[gmic]-1./follic/ Load thyroid follicle nuclei example image from local storage
[gmic]-2./ Resize image [1] to 128x128x1x1, with nearest-neighbor interpolation, dirichlet boundary conditions and alignment (0,0,0,0).
[gmic]-3./ Display images [0,1,2] = ‘follic, follic, follic_c1’.
[0] = ‘follic’:
size = (128,128,1,1) [64 Kio of floats].
data = (213,219,217,214,213,213,213,210,214,211,217,212,(…),208,212,217,211,213,211,216,212,208,213,217,216).
min = 70, max = 249, mean = 197.159, std = 28.0122, coords_min = (64,85,0,0), coords_max = (112,97,0,0).
[1] = ‘follic’:
size = (128,128,1,1) [64 Kio of floats].
data = (193,176,167,176,182,192,201,209,203,193,175,161,(…),159,165,162,128,117,112,107,105,109,109,118,119).
min = 27, max = 224, mean = 106.09, std = 49.8296, coords_min = (81,28,0,0), coords_max = (4,14,0,0).
[2] = ‘follic_c1’:
size = (128,128,1,1) [64 Kio of floats].
data = (1,1,1,1,1,1,1,1,1,1,1,1,(…),1,1,1,1,1,1,1,1,1,1,1,1).
min = 1, max = 1, mean = 1, std = 0, coords_min = (0,0,0,0), coords_max = (0,0,0,0).
[gmic]-3./ End G’MIC interpreter.

gmic m exa.gmic h linear_reg,0
[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Import commands from file ‘exa.gmic’ (1 new, total: 4203).
[gmic] Command ‘linear_reg’ has no description (did you mean ‘linear_x3’ ?). Try ‘gmic -h’ for global help.

You see, no help. If I put it into $_path_user help text appears!

gmic h linear_reg

gmic: GREYC’s Magic for Image Computing: command-line interface
(https://gmic.eu)
Version 2.9.0 (pre-release #200225)

    Copyright (c) 2008-2020, David Tschumperle / GREYC / CNRS. 
    (https://www.greyc.fr)

linear_reg:

  The idea is to build the system [X,1].[a;b] = [Y], where X and Y are the column vectors
  composed of the values of images X and Y you want to match, and [a;b] the vector of the
  coefficients you are looking for.
  This small piece of code compute a and b for two input images [0] = X and [1] = Y such
  that ||Y - (a.X + b)||^2 is minimum:

OK, that was a bug, it should work now, after $ gmic update.

1 Like

Works now. :slight_smile:

1 Like

I’m working on this. Should be ready before tonight probably (will require to recompile binary though).

It should be OK now, with latest version in the git repo.
@KaRo, could you confirm that something as:

$ gmic my_command.gmic -h my_command 

is working now ?

Yes, very good, it works!

Thank you

1 Like

David, very good the list of command file paths $_path_commands.

What about the non-local gmic files?

gmic m http://karo03.bplaced.net/gmic/test/linear_reg.gmic h linear_reg

It works for me:

$ gmic http://karo03.bplaced.net/gmic/test/linear_reg.gmic h linear_reg
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input custom command file 'http://karo03.bplaced.net/gmic/test/linear_reg.gmic' (1 new, total: 4150).
  gmic: GREYC's Magic for Image Computing: command-line interface 
        (https://gmic.eu) 
        Version 2.9.0 (pre-release #200303) 
 
        Copyright (c) 2008-2020, David Tschumperle / GREYC / CNRS. 
        (https://www.greyc.fr)

    linear_reg:

      The idea is to build the system [X,1].[a;b] = [Y], where X and Y are the column vectors
      composed of the values of images X and Y you want to match, and [a;b] the vector of the
      coefficients you are looking for.
      This small piece of code compute a and b for two input images [0] = X and [1] = Y such
      that ||Y - (a.X + b)||^2 is minimum:

Ha, actually that works only without the explicit call to m.
This is something I have to fix :slight_smile:

This is fixed with
https://github.com/dtschump/gmic/commit/485a845cbcd8ce9abfa0a5a5bd69e9a528a7deae

2 Likes

ok, ok, I am more quick in answering than reading…

Still the latest build against 12pm did not show an improvement for explicit m or command!

That is not expected. Are you sure you were using the ‘develop’ branch ?

Ok, I had forgotten to checkout develop!

Thank you!

1 Like