Slicer3:Execution Model Documentation:Debugging
Hints
You can use standard debuggers but you need to be sure that you have your path set correctly. You can use slicer3's launcher to set up the environment for you. See some windows examples.
Set the command line module (LinearRegistration in this example) to be the Start Up project for visual studio. You can cut and paste the arguments to the module from the log window (red X icon in lower right of the slicer interface).
The command line may look something like the following:
C:/pieper/bwh/slicer3/latest/Slicer3-build/bin/Debug/../../lib/Slicer3/Plugins/Debug/LinearRegistration.exe --histogrambins 30 --spatialsamples 10000 --iterations 1000,1000,500,200 --learningrate 0.01,0.005,0.0005,0.0002 --translationscale 100 c:/Documents and Settings/Administrator/Local Settings/Temp/Slicer3/EHGE_vtkMRMLScalarVolumeNodeB.nrrd c:/Documents and Settings/Administrator/Local Settings/Temp/Slicer3/EHGE_vtkMRMLScalarVolumeNodeD.nrrd c:/Documents and Settings/Administrator/Local Settings/Temp/Slicer3/EHGE_vtkMRMLScalarVolumeNodeE.nrrd
(note you may need to put quotes around file names that have spaces).
By default slicer will delete the temp files after the module completes. To disable this, use a command like this in the Tcl console:
[$::slicer3::CommandLineModuleGUI_Linear_registration GetLogic] DeleteTemporaryFilesOff
Cut and paste this entire line (including the brackets and dollar signs), but change the name of the module, e.g. Linear_registration in the line above should be changed to the name of your module.
Another useful technique for Visual Studio is to right click on your module project and pick "Select As Startup Project" from the menu. Then in the right click menu pick "Properties" and go to "Debugging" and paste in the command line options. This way you can replicate the behavior of your module and single step through it.