<br><br><div class="gmail_quote">On Mon, Oct 12, 2009 at 7:50 PM, Andrew Maclean <span dir="ltr"><<a href="mailto:andrew.amaclean@gmail.com">andrew.amaclean@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Could this script with appropriate modifications also be added to VTK?<br>
It strikes me as useful.<br></blockquote><div><br><br>Sure, that's just a change to the search paths (and a slight hack with 'find' to get all the files, which might be a better solution in the itk version too; see the script details below). Note that the file attribute on the script file is executable and I keep the script below in ${HOME}/bin/vtkSearchExamples.bash<br>
<br>This is an example run on my system (the script attached is suited to my install paths):<br><br><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">$ vtkSearchExamples.bash 'vtkIdentityTransform' 'vtkImageClip'</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Search term: vtkIdentityTransform</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Searching VTK files in: /opt/local/share/vtk/examples</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Searching VTK files in: /opt/local/share/vtk/testing</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Graphics/Testing/Tcl/TransformPolyData.tcl</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Search term: vtkImageClip</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Searching VTK files in: /opt/local/share/vtk/examples</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/opt/local/share/vtk/examples/ImageProcessing/Tcl/HistogramWidget.tcl</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Searching VTK files in: /opt/local/share/vtk/testing</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/VolumeRendering/Testing/Cxx/TestMinIntensityRendering.cxx</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Graphics/Testing/Tcl/contour2DAll.tcl</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Graphics/Testing/Tcl/contour3DAll.tcl</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Graphics/Testing/Tcl/imageMCAll.tcl</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Graphics/Testing/Tcl/sync3dAll.tcl</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Graphics/Testing/Tcl/testDataSetTriangleFilter.tcl</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Imaging/Testing/Tcl/TestAccumulate.tcl</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Imaging/Testing/Tcl/TestGradientMagnitude2.tcl</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Imaging/Testing/Tcl/TestSkeleton2D.tcl</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/opt/local/share/vtk/testing/Parallel/Testing/Tcl/TestBranchExtentTranslator.tcl</span><br style="font-family: courier new,monospace;">
<br><br><br></div></div>#######BEGIN SCRIPT<br><span style="font-family: courier new,monospace;">#!/bin/bash</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if [ $# -lt 1 ]; then</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> echo "$0 'search term' ['search term' ...]"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> exit 1</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">fi</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">vtkExamplePath="/opt/local/share/vtk/examples"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">vtkTestingPath="/opt/local/share/vtk/testing"</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">for term in $@; do</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> echo</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> echo "Search term: ${term}"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> for vtkPath in "${vtkExamplePath}" "${vtkTestingPath}" ; do</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if [ ! -d ${vtkPath} ]; then</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> echo "Path not found: ${vtkPath}"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> fi</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> echo "Searching VTK files in: ${vtkPath}"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> cxxFiles=$(find ${vtkPath} -name "*.cxx")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> grep -l -E -e ${term} ${cxxFiles}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> tclFiles=$(find ${vtkPath} -name "*.tcl")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> grep -l -E -e ${term} ${tclFiles}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> pyFiles=$(find ${vtkPath} -name "*.py")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> grep -l -E -e ${term} ${pyFiles}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> done</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">done</span><br>#######END SCRIPT<br>
<br><br>Again, feel free to incorporate this into the VTK cvs, with suitable open-source license that's compatible with vtk.<br><br>Take care,<br>Darren<br><br><br>