Hi J,<div><br></div><div>There is a bug in the ImageMath.bms script, thanks for finding this.</div><div><br></div><div>You can see that in the Condor script (ImageMath16.dagjob in your attachment) generated by BatchMake, the path to the mha file is incorrect (it appears to be duplicated) :<br>

<br></div><div>transfer_input_files =<br>/var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha//var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha</div>
<div><br></div><div><br></div><div><br></div><div>If you change your ImageMath.bms to the following (in $MIDASROOT/midas/plugins/batchmake/examples/tasks) code this should fix this problem.</div><div><br></div><div>Remember that these scripts are just examples for you to base your own work on.  Even so, they should work correctly and we aim for that.</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Thanks for your patience.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>
<div><br></div><div><br></div><div><div># Should the script end in case of errors</div><div>ExitOnError(1)</div><div><br></div><div># Imported parameters: cfg_input_cart, cfg_sigma</div><div>Include(ImageMath.config.bms)</div>
<div><br></div><div><br></div><div># Set Application Properties</div><div><br></div><div>SetApp(imageMath @ImageMath)</div><div>SetAppOption(imageMath.GaussianBlur 1)</div><div>SetAppOption(imageMath.GaussianBlur.Sigma ${cfg_sigma})</div>
<div>SetAppOption(imageMath.OutputFileType 1)</div><div>SetAppOption(imageMath.OutputFileType.FileType 3)</div><div><br></div><div><br></div><div>Foreach(file ${cfg_input_cart})</div><div>  SetAppOption(imageMath.InputFile ${file})</div>
<div><br></div><div>  GetFilename(name ${file} NAME_WITHOUT_EXTENSION)</div><div><br></div><div>  Set(outputFile ${name}.${cfg_output1}.mha)</div><div><br></div><div>  SetAppOption(imageMath.OutputFile "${outputFile}")</div>
<div>  CondorPostScript(imageMath ${cfg_condorpostscript} ${cfg_midas_baseURL} ${cfg_itemid} ${cfg_email} ${cfg_appname} ${cfg_apikey} ${cfg_output_directory} ${outputFile})</div><div>  Run(output ${imageMath})</div><div>
Endforeach(file)</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div class="gmail_quote">On Tue, May 24, 2011 at 6:08 AM,  <span dir="ltr"><<a href="mailto:j@dicomfly.com" target="_blank">j@dicomfly.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Michael,<br>
   is there something that continue to goes wrong.<br>
<br>
Following your istruction I successfully executed, outside Midas,<br>
ImageMath on ChestCT-SHORT.mha (from VTKData/Data/MetaIO/) with the<br>
following command:<br>
<br>
/var/www/opt/apps/bin/ImageMath ~/data/ChestCT-SHORT.mha -b 2 -W 3<br>
~/data/3_ChestCT-SHORT.sum.mha<br>
<br>
and it works!<br>
<br>
But, unfortunately, running inside Midas with $MIDAS_BATCHMAKE_USE_CONDOR = 1<br>
<br>
[ImageMath.16.dagjob]<br>
 Script generated by BatchMake (c) Insight Software Consortium<br>
# (c) Kitware Inc 2009<br>
# More information at: <a href="http://www.batchmake.org" target="_blank">http://www.batchmake.org</a><br>
<br>
Universe       = vanilla<br>
Output         = bmGrid.16.out.txt<br>
Error          = bmGrid.16.error.txt<br>
Log            = bmGrid.16.log.txt<br>
Notification   = NEVER<br>
Executable    = /var/www/opt/apps/bin/ImageMath<br>
Arguments     =<br>
"'/var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha//var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha'<br>
-b '2' -W '3' ''3_ChestCT-SHORT.sum.mha''"<br>
transfer_input_files =<br>
/var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha//var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha<br>
should_transfer_files = yes<br>
when_to_transfer_output = ON_EXIT_OR_EVICT<br>
Queue 1<br>
<br>
we have at least the following error:<br>
<br>
[from ImageMath.dagjob.dagman.out]<br>
05/24/11 01:04:41 From submit: ERROR: Can't open<br>
"/var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha/var/www/BASEDIR-batchmake/data/user_1/cart_3/3_ChestCT-SHORT.mha"<br>
 with flags 00 (Not a directory)<br>
<br>
Is there an error passing imagepath from midas/cart to<br>
batchmake/condor/ImageMath?<br>
<br>
How can I solve it?<br>
<br>
In the attached file, you can find debug and error midas logs, the<br>
complete SSP directory created by batchmake plugin to perform the<br>
requested job(s) (#18)...<br>
<br>
Thanks in advance<br>
<br>
Ciao<br>
<font color="#888888"><br>
J<br>
</font><div><div></div><div><br>
<br>
<br>
<br>
> Hi J,<br>
><br>
> At this time, executing locally (without Condor) isn't fully supported on<br>
> Midas, so you should be using<br>
><br>
> $MIDAS_BATCHMAKE_USE_CONDOR = 1<br>
><br>
> in your config_batchmake.php or config.batchmake.local.php files.<br>
><br>
><br>
><br>
> Do you have your Condor grid setup?<br>
><br>
><br>
><br>
> Since these are just example applications, you don't need to have them<br>
> running to use Midas and BatchMake.  If you have the PixelCounter<br>
> application running this should give you an example for sending files into<br>
> a<br>
> BatchMake application/script from within Midas.  These examples just give<br>
> you a basis for developing your own BatchMake scripts and applications.<br>
><br>
><br>
><br>
> As far as debugging, once you have the MIDAS_BATCHMAKE_USE_CONDOR option<br>
> set<br>
> to 1, there should appear some condor outputs and logs in your BatchMake<br>
> temporary (batchmake-basedir temp) execution directory, which you can use<br>
> to<br>
> see any problems.<br>
><br>
><br>
><br>
> One problem in this case, judging from your output of "Error:<br>
> SetAppOption:<br>
> Cannot find parameter: GaussianBlur.", is probably that incorrect .bmm<br>
> files<br>
> (or none at all) were packaged with Midas.  I'm attaching the appropriate<br>
> .bmm file for the ImageMath application.  Place this in the directory you<br>
> have defined for MIDAS_BATCHMAKE_APPLICATION_DIRECTORY, and change the<br>
> path<br>
> in the .bmm file to the correct path to the ImageMath application.<br>
><br>
><br>
> I hope this helps.<br>
><br>
><br>
><br>
><br>
><br>
> On Wed, May 18, 2011 at 6:55 AM, <<a href="mailto:j@dicomfly.com" target="_blank">j@dicomfly.com</a>> wrote:<br>
><br>
>> Hi Michael,<br>
>>   following your info I was able to successfully execute PixelCounter<br>
>> (without and with condor=execute_in_server). I saw the following echo<br>
>> and I found output xml:<br>
>><br>
>> #use_condor=0<br>
>> Executing ...<br>
>> Status: Start /var/www/opt/batchmake/bin/PixelCounter<br>
>> /var/www/BASEDIR-batchmake/data/user_1/cart_2/10_AddTest_DOUBLE.mha 10<br>
>> --ofxml 10_AddTest_DOUBLE.output.xml<br>
>> run: '/var/www/opt/batchmake/bin/PixelCounter'<br>
>> '''/var/www/BASEDIR-batchmake/data/user_1/cart_2/10_AddTest_DOUBLE.mha'<br>
>> '10' --ofxml '10_AddTest_DOUBLE.output.xml'''<br>
>> Status: Finish: Execution time 315ms<br>
>><br>
>> Unfortunately, trying to run ImageMathAdder (following rigorously the<br>
>> info<br>
>> in the bms file: i.e. png filenames in cart1 and cart2, etc.), something<br>
>> goes wrong: I cannot find any output image.<br>
>><br>
>> I saw the following echo (only one line):<br>
>> Executing ...<br>
>><br>
>> I tried to understand what happens checking in logs and in<br>
>> batchmake-basedir temp folder but without success (apparently no<br>
>> errors...)<br>
>><br>
>> For ImageMath a different error is returned:<br>
>> Executing ...<br>
>> Error: SetAppOption: Cannot find parameter: GaussianBlur.<br>
>><br>
>><br>
>> Any advice?<br>
>><br>
>> Thanks in advance...<br>
>><br>
>> J<br>
>><br>
>><br>
>><br>
>> > Hi J,<br>
>> ><br>
>> > Can you tell me more about what you are trying to accomplish with<br>
>> Midas?<br>
>> > I<br>
>> > might be able to give you some better advice if I know this.<br>
>> ><br>
>> ><br>
>> ><br>
>> > PixelCounter won't work with DICOM images, it is really more of an<br>
>> example<br>
>> > or demo application for testing out the BatchMake/Condor<br>
>> infrastructure.<br>
>> >  This is useful to test before you do any other development, so you<br>
>> can<br>
>> be<br>
>> > sure the infrastructure works correctly.<br>
>> ><br>
>> ><br>
>> > Here is a link that covers some of this information.  If anything is<br>
>> > unclear<br>
>> > or you would like more details in a particular area, please let us<br>
>> know<br>
>> as<br>
>> > we are always trying to improve the documentation.<br>
>> ><br>
>> ><br>
>> <a href="http://www.kitware.com/midaswiki/index.php/Plugins:BatchMake#Adding_a_BatchMake_script_to_the_Midas_BatchMake_Plugin" target="_blank">http://www.kitware.com/midaswiki/index.php/Plugins:BatchMake#Adding_a_BatchMake_script_to_the_Midas_BatchMake_Plugin</a><br>


>> ><br>
>> ><br>
>> ><br>
>> > For the PixelCounter application, you can use some sphere image files<br>
>> as<br>
>> > inputs.  In the BatchMake build directory, under bin, if you<br>
>> configured<br>
>> > BatchMake with BUILD_EXAMPLES = on, you should have a GenerateSpheres<br>
>> > executable.  If you run this, it will generate several sphere images<br>
>> files<br>
>> > for you.  You can upload some of these to Midas, then create a cart<br>
>> and<br>
>> > add<br>
>> > the images to the cart.  Use this cart as the input to the<br>
>> PixelCounter<br>
>> > application.<br>
>> ><br>
>> ><br>
>> ><br>
>> > Once you run the PixelCounter, you can use the Midas logs to help<br>
>> debug<br>
>> > problems.  Also, look in the directory defined for<br>
>> ><br>
>> > $MIDAS_BATCHMAKE_TEMP_DIRECTORY<br>
>> ><br>
>> > in your BatchMake Midas plugin configuration file.  Here you will see<br>
>> the<br>
>> > temporary directories associated with BatchMake processing in Midas,<br>
>> and<br>
>> > the<br>
>> > generated Condor output files there can help you debug further<br>
>> problems.<br>
>> ><br>
>> ><br>
>> ><br>
>> > I think the development version of Midas taken out of the Git<br>
>> repository<br>
>> > (2.8.1) is the best one to use for doing BatchMake plugin development,<br>
>> as<br>
>> > this area of Midas is under active development.<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > On Sat, May 7, 2011 at 12:26 PM, J <<a href="mailto:j@dicomfly.com" target="_blank">j@dicomfly.com</a>> wrote:<br>
>> ><br>
>> >>  Hi Michael,<br>
>> >>         batchmake plugin now seems to work even if PixelCounter<br>
>> example<br>
>> >> runs but does not produce any output: any idea? I tried to process<br>
>> DICOM<br>
>> >> images...<br>
>> >><br>
>> >> Which is the better Midas version to use? (2.8.1, 2.9, ??)<br>
>> >><br>
>> >> Thanks in advance<br>
>> >><br>
>> >> J<br>
>> >><br>
>> >><br>
>> >><br>
>> >> At 16.48 05/05/2011, you wrote:<br>
>> >><br>
>> >> Hi J,<br>
>> >><br>
>> >> First off, you will want to upgrade your BatchMake to the current<br>
>> >> development version to take advantage of integration with Midas and<br>
>> >> Condor:<br>
>> >><br>
>> >>  <a href="http://batchmake.org/batchmake/resources/software.html" target="_blank">http://batchmake.org/batchmake/resources/software.html</a><br>
>> >><br>
>> >> You can clone from git and then build the source using Cmake.<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> A couple things to think about before running any BatchMake<br>
>> applications<br>
>> >> from within Midas:<br>
>> >><br>
>> >> -Is your condor grid status correctly viewable from the "Midas Grid<br>
>> >> Status"<br>
>> >> link of the BatchMake plugin?<br>
>> >> -Are all of the configuration settings correct (green colored) from<br>
>> the<br>
>> >> "Check Configuration" link of the BatchMake plugin?<br>
>> >><br>
>> >><br>
>> >><br>
>> >> There should be more detailed error messages available in the Midas<br>
>> >> logs.<br>
>> >> Look in the MIDAS_INSTALL_DIR/midas/tmp/logs/error.log , this will<br>
>> help<br>
>> >> you<br>
>> >> with your specific problem.<br>
>> >><br>
>> >><br>
>> >> Let me know if this helps.<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Thanks,<br>
>> > Michael Grauer<br>
>> > R & D Engineer<br>
>> > Kitware, Inc.<br>
>> > <a href="tel:919%20969%206990%20x322" value="+19199696990" target="_blank">919 969 6990 x322</a><br>
>> ><br>
>><br>
>><br>
>><br>
><br>
><br>
> --<br>
> Thanks,<br>
> Michael Grauer<br>
> R & D Engineer<br>
> Kitware, Inc.<br>
> <a href="tel:919%20969%206990%20x322" value="+19199696990" target="_blank">919 969 6990 x322</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Thanks,<br>Michael Grauer<br>R & D Engineer<br>Kitware, Inc.<br><a href="tel:919%20969%206990%20x322" value="+19199696990" target="_blank">919 969 6990 x322</a><br>
<br><br><br>
</div>