Login  Register

Re: bUnwarpJ - loading mask from macro

Posted by Michael Schmid on Jun 14, 2011; 9:27am
URL: http://imagej.273.s1.nabble.com/bUnwarpJ-loading-mask-from-macro-tp3684161p3684162.html

Hi Jamier,

note that the macro syntax is rather strict. Don't put a blank  
between keyword and "=":
>   run("bUnwarpJ", " load =" + maskPath + ....
should become
    run("bUnwarpJ", " load=" + maskPath + ....

Also, don't forget to put square brackets around the path, in case it  
should contain spaces.

Michael
________________________________________________________________

On 13 Jun 2011, at 15:11, jamier wrote:

> Hello All,
>
> I am a novice using imageJ. At the moment I am working on a project  
> whereby
> I wish to register bone scans to a target bone scan. I must load a  
> mask
> prior to registration. This works successfully using the I/O menu of
> bUnwarpJ. Using the macro->record function of imageJ it appears the
> following command should load my saved mask file prior to registering:
>
> run("bUnwarpJ",
> "load=/home/jamier/Fiji/BoneScans/Normals/Masks/N3_Ant_Mask.jpg
> source_image=[Source Anterior] target_image=[Target Anterior]
> registration=Accurate image_subsample_factor=0 initial_deformation=
> [Very
> Coarse] final_deformation=Fine divergence_weight=0 curl_weight=0
> landmark_weight=0 image_weight=1 consistency_weight=10
> stop_threshold=0.01");
>
> I have written a short macro which opens the desired source image  
> plus a
> dialogue for adjusting the various bUnwarpJ weights. However, this  
> load
> source mask call does not work in my macro and the registration occurs
> without any mask and the corresponding registration is very poor. The
> section of my macro where bUnwarpJ is called is highlighted below.  
> Is there
> a straightforward way to load a saved mask in bUnwarpJ using macros?
>
> if (maskbool==1)
> {
> //run bUnwarpJ with source mask
>
>  run("bUnwarpJ",
>  " load =" + maskPath +
>  " source_image=" + si + " target_image=" + ti + " registration=" +  
> r + "
> image_subsample_factor="+ img_sub_factor + " initial_deformation="  
> + id + "
> final_deformation=" + fd + " divergence_weight=" + dw + "  
> curl_weight=" +
> curlw + " landmark_weight="+ lw + " image_weight=" + iw + "
> consistency_weight=" + conw + " stop_threshold=" + st + " " +  
> verbose +
> str);
> }