"Block Matching Correspondences" Plugin Run Via Macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
GP
Reply | Threaded
Open this post in threaded view
|

"Block Matching Correspondences" Plugin Run Via Macro

GP
Hie!

I wanted to run Extract Feature Plugin >>Extract Block Matching Correspondences directly from macro command over folders.

In this process I would like to use one particular image as source image for the entire folder.
Rest of the images in the folder will serve as target images.  All files have same name format and are in the same folder (96images per folder).

Please let me know how can I write such a macro.

Thank you so much.

Best Regards
GP
Reply | Threaded
Open this post in threaded view
|

Re: "Block Matching Correspondences" Plugin Run Via Macro

GP
Hie!

I have concocted a rudimentary macro (below). The problem is that for some reason I can't specify the target image. I have tried several combinations of SelectWindow, selectImageiID etc commands but could not make it work.

run("Clear Results");

dir1 = getDirectory("Choose  Directory ");
list = getFileList(dir1);

setBatchMode(false);
for (i=0;i<list.length;i++) {
   

      if (endsWith(list[i],"tif") || endsWith(list[i],"TIF")){
      open(dir1+ list[i]);
      TargetImg= getTitle();
      open("/Users.../temp/WE00001---CO2_qmle.tif");
      //tt= selectWindow(TargetTitle);
run("Extract Block Matching Correspondences", "source_image=WE00001---CO2_qmle.tif target_image=<b>TargetImg layer_scale=1 search_radius=50 block_radius=50 resolution=24 minimal_pmcc_r=0.10 maximal_curvature_ratio=1000 maximal_second_best_r/best_r=1 use_local_smoothness_filter approximate_local_transformation=Rigid local_region_sigma=65 maximal_local_displacement=12 maximal_local_displacement=3");
      close();
      } }


Kindly let me know what am I missing out here.
Help will be much appreciated.
Thanks a lot
Reply | Threaded
Open this post in threaded view
|

Re: "Block Matching Correspondences" Plugin Run Via Macro

Straub, Volko A. (Dr.)
Hi,

There appears to be a mismatch between the variable name used by
getTitle() and the subsequent call of selectWindow(). Your getTitle()
call assigns the image name to a variable called TargetImg. However,
your selectWindow call uses a variable TargetTitle, which is not defined
in your macro.

Hope this helps,
Volko

On 14/01/2017 02:09, GP wrote:

> Hie!
>
> I have concocted a rudimentary macro (below). The problem is that for some
> reason I can't specify the target image. I have tried several combinations
> of SelectWindow, selectImageiID etc commands but could not make it work.
>
> /run("Clear Results");
>
> dir1 = getDirectory("Choose  Directory ");
> list = getFileList(dir1);
>
> setBatchMode(false);
> for (i=0;i<list.length;i++) {
>      
>
>        if (endsWith(list[i],&quot;tif&quot;) ||
> endsWith(list[i],&quot;TIF&quot;)){
>        open(dir1+ list[i]);
>        TargetImg= getTitle();
>        open(&quot;/Users.../temp/WE00001---CO2_qmle.tif&quot;);
>        //tt= selectWindow(TargetTitle);
> run(&quot;Extract Block Matching Correspondences&quot;,
> &quot;source_image=WE00001---CO2_qmle.tif target_image=&lt;b>TargetImg*
> layer_scale=1 search_radius=50 block_radius=50 resolution=24
> minimal_pmcc_r=0.10 maximal_curvature_ratio=1000
> maximal_second_best_r/best_r=1 use_local_smoothness_filter
> approximate_local_transformation=Rigid local_region_sigma=65
> maximal_local_displacement=12 maximal_local_displacement=3");
>        close();
>        } } /
>
> Kindly let me know what am I missing out here.
> Help will be much appreciated.
> Thanks a lot
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Block-Matching-Correspondences-Plugin-Run-Via-Macro-tp5017882p5017890.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
GP
Reply | Threaded
Open this post in threaded view
|

Re: "Block Matching Correspondences" Plugin Run Via Macro

GP
Hie!

Thanks for noticing but its an inactive statement I forgot to delete it . Sorry about that.
Please let me know if you find any other loophole or ideas. 

Best Regards,

On Sat, Jan 14, 2017 at 11:48 AM, Volko Straub [via ImageJ] <[hidden email]> wrote:
Hi,

There appears to be a mismatch between the variable name used by
getTitle() and the subsequent call of selectWindow(). Your getTitle()
call assigns the image name to a variable called TargetImg. However,
your selectWindow call uses a variable TargetTitle, which is not defined
in your macro.

Hope this helps,
Volko

On 14/01/2017 02:09, GP wrote:

> Hie!
>
> I have concocted a rudimentary macro (below). The problem is that for some
> reason I can't specify the target image. I have tried several combinations
> of SelectWindow, selectImageiID etc commands but could not make it work.
>
> /run("Clear Results");
>
> dir1 = getDirectory("Choose  Directory ");
> list = getFileList(dir1);
>
> setBatchMode(false);
> for (i=0;i<list.length;i++) {
>      
>
>        if (endsWith(list[i],&quot;tif&quot;) ||
> endsWith(list[i],&quot;TIF&quot;)){
>        open(dir1+ list[i]);
>        TargetImg= getTitle();
>        open(&quot;/Users.../temp/WE00001---CO2_qmle.tif&quot;);
>        //tt= selectWindow(TargetTitle);
> run(&quot;Extract Block Matching Correspondences&quot;,
> &quot;source_image=WE00001---CO2_qmle.tif target_image=&lt;b>TargetImg*
> layer_scale=1 search_radius=50 block_radius=50 resolution=24
> minimal_pmcc_r=0.10 maximal_curvature_ratio=1000
> maximal_second_best_r/best_r=1 use_local_smoothness_filter
> approximate_local_transformation=Rigid local_region_sigma=65
> maximal_local_displacement=12 maximal_local_displacement=3");
>        close();
>        } } /
>
> Kindly let me know what am I missing out here.
> Help will be much appreciated.
> Thanks a lot
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Block-Matching-Correspondences-Plugin-Run-Via-Macro-tp5017882p5017890.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Block-Matching-Correspondences-Plugin-Run-Via-Macro-tp5017882p5017891.html
To unsubscribe from "Block Matching Correspondences" Plugin Run Via Macro, click here.
NAML



--
Gunjan Pandey

Reply | Threaded
Open this post in threaded view
|

Re: "Block Matching Correspondences" Plugin Run Via Macro

Straub, Volko A. (Dr.)
Hi,

Okay, I noticed that you had commented out the line, but assumed that
this was just to make the macro run. Anyway, looks like there are issues
when you try to pass your arguments. See macro documentation of 'run'
command for details
(https://imagej.nih.gov/ij/developer/macro/functions.html#R). I suspect
that trying to include a conditional statement (;b>TargetImg*) will
cause problems. The ; is probably also unnecessary and the wildcard
character '*' at the end might cause further problems. If you only want
to execute the command for certain images, put the whole command inside
an if-statement.

Hope this helps,
Volko


On 14/01/2017 12:06, GP wrote:

> Hie!
>
> Thanks for noticing but its an inactive statement I forgot to delete it .
> Sorry about that.
> Please let me know if you find any other loophole or ideas.
>
> Best Regards,
>
> On Sat, Jan 14, 2017 at 11:48 AM, Volko Straub [via ImageJ] <
> [hidden email]> wrote:
>
>> Hi,
>>
>> There appears to be a mismatch between the variable name used by
>> getTitle() and the subsequent call of selectWindow(). Your getTitle()
>> call assigns the image name to a variable called TargetImg. However,
>> your selectWindow call uses a variable TargetTitle, which is not defined
>> in your macro.
>>
>> Hope this helps,
>> Volko
>>
>> On 14/01/2017 02:09, GP wrote:
>>
>>> Hie!
>>>
>>> I have concocted a rudimentary macro (below). The problem is that for
>> some
>>> reason I can't specify the target image. I have tried several
>> combinations
>>> of SelectWindow, selectImageiID etc commands but could not make it work.
>>>
>>> /run("Clear Results");
>>>
>>> dir1 = getDirectory("Choose  Directory ");
>>> list = getFileList(dir1);
>>>
>>> setBatchMode(false);
>>> for (i=0;i<list.length;i++) {
>>>
>>>
>>>         if (endsWith(list[i],&quot;tif&quot;) ||
>>> endsWith(list[i],&quot;TIF&quot;)){
>>>         open(dir1+ list[i]);
>>>         TargetImg= getTitle();
>>>         open(&quot;/Users.../temp/WE00001---CO2_qmle.tif&quot;);
>>>         //tt= selectWindow(TargetTitle);
>>> run(&quot;Extract Block Matching Correspondences&quot;,
>>> &quot;source_image=WE00001---CO2_qmle.tif target_image=&lt;b>TargetImg*
>>> layer_scale=1 search_radius=50 block_radius=50 resolution=24
>>> minimal_pmcc_r=0.10 maximal_curvature_ratio=1000
>>> maximal_second_best_r/best_r=1 use_local_smoothness_filter
>>> approximate_local_transformation=Rigid local_region_sigma=65
>>> maximal_local_displacement=12 maximal_local_displacement=3");
>>>         close();
>>>         } } /
>>>
>>> Kindly let me know what am I missing out here.
>>> Help will be much appreciated.
>>> Thanks a lot
>>>
>>>
>>>
>>> --
>>> View this message in context: http://imagej.1557.x6.nabble.
>> com/Block-Matching-Correspondences-Plugin-Run-Via-Macro-tp5017882p5017890.
>> html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://imagej.1557.x6.nabble.com/Block-Matching-
>> Correspondences-Plugin-Run-Via-Macro-tp5017882p5017891.html
>> To unsubscribe from "Block Matching Correspondences" Plugin Run Via Macro, click
>> here
>> <
>> .
>> NAML
>> <
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
GP
Reply | Threaded
Open this post in threaded view
|

Re: "Block Matching Correspondences" Plugin Run Via Macro

GP
Hie!

Thank you for helping out :)
I guess something went wrong with the formatting as I was trying to italicize the code while typing it here.

Fixed the problem though, here's the code that works: 

run("Clear Results"); 

dir1 = getDirectory("Choose  Directory "); 
list = getFileList(dir1); 

setBatchMode(false); 
for (i=0;i<list.length;i++) 
    
  if (endsWith(list[i],"tif") || endsWith(list[i],"TIF"))
      { 
      open("WE00001--CO2_qmle.tif");
      SourceTitle= getTitle();
      open(dir1+ list[i]); 
      TargetTitle= getTitle();
      run("Extract Block Matching Correspondences", "source_image=SourceTitle target_image=TargetTitle layer_scale=1 search_radius=50 block_radius=50 resolution=24 minimal_pmcc_r=0.10 maximal_curvature_ratio=1000 maximal_second_best_r/best_r=1 use_local_smoothness_filter approximate_local_transformation=Rigid local_region_sigma=65 maximal_local_displacement=12 maximal_local_displacement=3");
      while (nImages>0)
      { 
      selectImage(nImages); 
      close(); 
      } 
}     
      } 

Thanks again. 

On Sun, Jan 15, 2017 at 7:40 AM, Volko Straub [via ImageJ] <[hidden email]> wrote:
Hi,

Okay, I noticed that you had commented out the line, but assumed that
this was just to make the macro run. Anyway, looks like there are issues
when you try to pass your arguments. See macro documentation of 'run'
command for details
(https://imagej.nih.gov/ij/developer/macro/functions.html#R). I suspect
that trying to include a conditional statement (;b>TargetImg*) will
cause problems. The ; is probably also unnecessary and the wildcard
character '*' at the end might cause further problems. If you only want
to execute the command for certain images, put the whole command inside
an if-statement.

Hope this helps,
Volko


On 14/01/2017 12:06, GP wrote:

> Hie!
>
> Thanks for noticing but its an inactive statement I forgot to delete it .
> Sorry about that.
> Please let me know if you find any other loophole or ideas.
>
> Best Regards,
>
> On Sat, Jan 14, 2017 at 11:48 AM, Volko Straub [via ImageJ] <
> [hidden email]> wrote:

>
>> Hi,
>>
>> There appears to be a mismatch between the variable name used by
>> getTitle() and the subsequent call of selectWindow(). Your getTitle()
>> call assigns the image name to a variable called TargetImg. However,
>> your selectWindow call uses a variable TargetTitle, which is not defined
>> in your macro.
>>
>> Hope this helps,
>> Volko
>>
>> On 14/01/2017 02:09, GP wrote:
>>
>>> Hie!
>>>
>>> I have concocted a rudimentary macro (below). The problem is that for
>> some
>>> reason I can't specify the target image. I have tried several
>> combinations
>>> of SelectWindow, selectImageiID etc commands but could not make it work.
>>>
>>> /run("Clear Results");
>>>
>>> dir1 = getDirectory("Choose  Directory ");
>>> list = getFileList(dir1);
>>>
>>> setBatchMode(false);
>>> for (i=0;i<list.length;i++) {
>>>
>>>
>>>         if (endsWith(list[i],&quot;tif&quot;) ||
>>> endsWith(list[i],&quot;TIF&quot;)){
>>>         open(dir1+ list[i]);
>>>         TargetImg= getTitle();
>>>         open(&quot;/Users.../temp/WE00001---CO2_qmle.tif&quot;);
>>>         //tt= selectWindow(TargetTitle);
>>> run(&quot;Extract Block Matching Correspondences&quot;,
>>> &quot;source_image=WE00001---CO2_qmle.tif target_image=&lt;b>TargetImg*
>>> layer_scale=1 search_radius=50 block_radius=50 resolution=24
>>> minimal_pmcc_r=0.10 maximal_curvature_ratio=1000
>>> maximal_second_best_r/best_r=1 use_local_smoothness_filter
>>> approximate_local_transformation=Rigid local_region_sigma=65
>>> maximal_local_displacement=12 maximal_local_displacement=3");
>>>         close();
>>>         } } /
>>>
>>> Kindly let me know what am I missing out here.
>>> Help will be much appreciated.
>>> Thanks a lot
>>>
>>>
>>>
>>> --
>>> View this message in context: http://imagej.1557.x6.nabble.
>> com/Block-Matching-Correspondences-Plugin-Run-Via-Macro-tp5017882p5017890.
>> html
>>> Sent from the ImageJ mailing list archive at Nabble.com.
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Block-Matching-Correspondences-Plugin-Run-Via-Macro-tp5017882p5017899.html
To unsubscribe from "Block Matching Correspondences" Plugin Run Via Macro, click here.
NAML



--
Gunjan Pandey