I'm trying to write a script which compares pairs of MRI images in a 3rd party image processing app. However, I need to pass it some command-line parameters to generate the output images.
I've got a directory full of files of this format:
T1_00001.jpg and T2_00001.jpg, where the 2nd half number sequence increases by 1 and there are always pairs and always start at 00001.
I'm trying to create a script that reads all of the T1_..... files in the directory, counts them and then repeatedly runs a command line script to generate the images using a series of wildcard numbers.
I start off by counting all those T1 files like this:
That works great and counts all of the files beginning with "T1_" as expected, allowing me to generate the sequence of numbers I need to use.
However, I struggle at the next step (which should be simple!). I need to run a command of this format:
I'm trying to figure out a powershell way of running that command the correct number of times, substituting the numeric part with a 5 digit number generated from the count I collected above. This is where I'm currently stuck, so any help with this would be very much appreciated.
I've got a directory full of files of this format:
T1_00001.jpg and T2_00001.jpg, where the 2nd half number sequence increases by 1 and there are always pairs and always start at 00001.
I'm trying to create a script that reads all of the T1_..... files in the directory, counts them and then repeatedly runs a command line script to generate the images using a series of wildcard numbers.
I start off by counting all those T1 files like this:
Code:
Get-ChildItem -filter 'T1_*' -path 'C:\MRIs' | Measure-Object | Select -ExpandProperty Count
That works great and counts all of the files beginning with "T1_" as expected, allowing me to generate the sequence of numbers I need to use.
However, I struggle at the next step (which should be simple!). I need to run a command of this format:
Code:
convert T1_00001.jpg T2_00001.jpg -compose minus -composite Result_00001.jpg
I'm trying to figure out a powershell way of running that command the correct number of times, substituting the numeric part with a 5 digit number generated from the count I collected above. This is where I'm currently stuck, so any help with this would be very much appreciated.