19 #include <tclap/CmdLine.h> 23 #include <milxImage.h> 25 using namespace TCLAP;
27 typedef std::vector< std::string >::iterator stringiterator;
30 enum operations {none = 0, info, convert, labelinfo, rescale, invert, relabel, smooth, bilateral, median, gradmag, laplacian, distancemap, threshold, Otsu, crop, mask, resample, match, checker, add, diff, mean, merge, cast, flip};
33 typedef unsigned char charPixelType;
34 typedef itk::Image<charPixelType, milx::imgDimension> charImageType;
35 typedef float floatPixelType;
36 typedef itk::Image<floatPixelType, milx::imgDimension> floatImageType;
37 typedef itk::VectorImage<floatPixelType, milx::imgDimension> vectorImageType;
69 int main(
int argc,
char *argv[])
73 milx::PrintInfo(
"--------------------------------------------------------");
78 milx::PrintInfo(
"Australian e-Health Research Centre, CSIRO, Australia.");
79 milx::PrintInfo(
"--------------------------------------------------------\n");
83 CmdLine cmd(
"A diagnostic tool for image/volume operations",
' ',
milx::NumberToString(milx::Version));
86 ValueArg<size_t> threadsArg(
"",
"threads",
"Set he number of global threads to use.",
false,
milx::NumberOfProcessors(),
"Threads");
87 ValueArg<std::string> outputArg(
"o",
"output",
"Output Image",
false,
"result.nii.gz",
"Output");
88 ValueArg<std::string> prefixArg(
"p",
"prefix",
"Output prefix for multiple output.",
false,
"img_",
"Output Prefix");
90 ValueArg<float> smoothArg(
"s",
"smooth",
"Smooth the images using the Gradient Anisotropic Diffusion algorithm given timestep (use negative value to auto select).",
false, -1.0,
"Smooth");
91 ValueArg<float> bilateralArg(
"",
"bilateral",
"Smooth the images using the Bilteral algorithm given range sigma. Use sigma argument for provide spatial sigma.",
false, 0.1,
"Bilateral");
92 ValueArg<size_t> medianArg(
"",
"median",
"Smooth the images using the median filtering given the number of pixels in neighbourhood.",
false, 1,
"Median");
93 ValueArg<size_t> mergeArg(
"",
"merge",
"Merge the labels in labelled images, 0:keep, 1:aggregate, 2:pack, 3:strict.",
false, 0,
"Merge");
94 ValueArg<std::string> cropArg(
"",
"crop",
"Masks and crops the images using the mask image name provided.",
false,
"mask.nii.gz",
"Crop");
95 ValueArg<std::string> maskArg(
"m",
"mask",
"Masks the images using the mask image name provided.",
false,
"mask.nii.gz",
"Mask");
96 ValueArg<std::string> resampleArg(
"",
"resample",
"Resample the images to the reference image provided assuming they are both already in the correct space.",
false,
"reference.nii.gz",
"Resample");
97 ValueArg<std::string> matchArg(
"",
"match",
"Match the histograms of the images to the reference image provided.",
false,
"reference.nii.gz",
"Match");
98 ValueArg<std::string> checkerArg(
"",
"checkerboard",
"Checkerboard all of the images to the reference image provided.",
false,
"reference.nii.gz",
"Checkerboard");
100 ValueArg<float> aboveArg(
"",
"above",
"Add above value to operation (such as to thresholding).",
false, 0.0,
"Above");
101 ValueArg<float> belowArg(
"",
"below",
"Add below value to operation (such as to thresholding).",
false, 255.0,
"Below");
102 ValueArg<float> insideArg(
"",
"inside",
"Add inside value to operation (such as to thresholding).",
false, 1.0,
"Inside");
103 ValueArg<float> sigmaArg(
"",
"sigma",
"Sigma (Stddev) value to operation (such as to bilateral).",
false, 1.0,
"Sigma");
104 ValueArg<size_t> iterationsArg(
"i",
"iterations",
"Number of iterations to use in the operation (such as smoothing).",
false, 5,
"Labels");
105 ValueArg<size_t> labelsArg(
"",
"labels",
"Number of labels to use in the operation (such as Otsu thresholding) else print labelling info.",
false, 3,
"Labels");
106 ValueArg<size_t> OtsuArg(
"",
"Otsu",
"Otsu multiple threshold with the number of bins to use.",
false, 128,
"Otsu");
107 ValueArg<size_t> paddingArg(
"",
"padding",
"Number of pixels to pad in the operation in question (such as crop).",
false, 1,
"Padding");
108 ValueArg<size_t> flipArg(
"f",
"flip",
"Flip the image about origin at axis indicated (0: x-axis, 1:y-axis, 2:z-axis).",
false, 0,
"Flip");
111 SwitchArg infoArg(
"",
"info",
"Report the image information(s).",
false);
112 SwitchArg labelInfoArg(
"",
"labelinfo",
"Report the label information for a labelled image. Same as --info --labels arguments.",
false);
113 SwitchArg convertArg(
"c",
"convert",
"Convert the image from current format to the one given at output.",
false);
114 SwitchArg gradMagArg(
"g",
"gradmag",
"Compute the Gradient magnitude (show edges) of the image(s).",
false);
115 SwitchArg laplacianArg(
"l",
"laplacian",
"Compute the Laplacian of the image(s).",
false);
116 SwitchArg distancemapArg(
"d",
"distancemap",
"Compute the Signed Distance map of the image(s).",
false);
117 SwitchArg thresholdArg(
"t",
"threshold",
"Compute the Threshold of the image(s).",
false);
118 SwitchArg binaryArg(
"b",
"binary",
"Compute the binary version of the operation(s).",
false);
119 SwitchArg rescaleArg(
"r",
"rescale",
"Re-scale the intensities of the image to a given range (set inconjuction with the above and below arguments).",
false);
120 SwitchArg invertArg(
"",
"invert",
"Invert the intensities of the images.",
false);
121 SwitchArg relabelArg(
"",
"relabel",
"Relabel the labels of the labelled image consecutatively based on connectivity.",
false);
122 SwitchArg addArg(
"",
"add",
"Add/Sum the provided images together (pixel-wise).",
false);
123 SwitchArg diffArg(
"",
"diff",
"Difference the provided images from the first image (pixel-wise).",
false);
124 SwitchArg meanArg(
"",
"mean",
"Average the provided images together (pixel-wise).",
false);
125 SwitchArg castArg(
"",
"cast",
"Cast the images from 8-bit to floating-point type (or vice-versa) depending on the input type.",
false);
131 UnlabeledMultiArg<std::string> multinames(
"images",
"Images to operate on (pixel type is auto detected from the first image)",
true,
"Images");
134 cmd.add( multinames );
135 cmd.add( threadsArg );
136 cmd.add( outputArg );
137 cmd.add( prefixArg );
142 cmd.add( insideArg );
144 cmd.add( binaryArg );
145 cmd.add( iterationsArg );
146 cmd.add( labelsArg );
147 cmd.add( paddingArg );
149 std::vector<Arg*> xorlist;
150 xorlist.push_back(&infoArg);
151 xorlist.push_back(&convertArg);
154 xorlist.push_back(&smoothArg);
155 xorlist.push_back(&bilateralArg);
156 xorlist.push_back(&medianArg);
157 xorlist.push_back(&gradMagArg);
158 xorlist.push_back(&laplacianArg);
159 xorlist.push_back(&distancemapArg);
160 xorlist.push_back(&thresholdArg);
161 xorlist.push_back(&OtsuArg);
162 xorlist.push_back(&rescaleArg);
163 xorlist.push_back(&invertArg);
164 xorlist.push_back(&relabelArg);
165 xorlist.push_back(&maskArg);
166 xorlist.push_back(&resampleArg);
167 xorlist.push_back(&matchArg);
168 xorlist.push_back(&checkerArg);
169 xorlist.push_back(&addArg);
170 xorlist.push_back(&diffArg);
171 xorlist.push_back(&meanArg);
172 xorlist.push_back(&castArg);
173 xorlist.push_back(&flipArg);
175 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members 176 xorlist.push_back(&labelInfoArg);
177 xorlist.push_back(&mergeArg);
178 xorlist.push_back(&cropArg);
183 cmd.parse( argc, argv );
187 const size_t threads = threadsArg.getValue();
188 std::vector<std::string> filenames = multinames.getValue();
189 std::string outputName = outputArg.getValue();
190 const std::string prefixName = prefixArg.getValue();
191 const std::string resampleName = resampleArg.getValue();
192 const std::string matchName = matchArg.getValue();
193 const std::string checkerName = checkerArg.getValue();
196 const float smoothTimestep = smoothArg.getValue();
197 const float rangeSigma = bilateralArg.getValue();
198 const size_t radius = medianArg.getValue();
199 const size_t mergeType = mergeArg.getValue();
200 float aboveValue = aboveArg.getValue();
201 float belowValue = belowArg.getValue();
202 float insideValue = insideArg.getValue();
203 float sigmaValue = sigmaArg.getValue();
204 size_t iterations = iterationsArg.getValue();
205 size_t labelsValue = labelsArg.getValue();
206 size_t OtsuValue = OtsuArg.getValue();
207 size_t paddingValue = paddingArg.getValue();
208 size_t flipAxis = flipArg.getValue();
210 std::string maskName;
212 maskName = cropArg.getValue();
214 maskName = maskArg.getValue();
217 itk::MultiThreader::SetGlobalDefaultNumberOfThreads(threads);
221 operations operation = none;
222 bool outputRequired =
false;
223 bool multiOutputRequired =
true;
226 outputRequired =
false;
227 multiOutputRequired =
false;
232 if(labelInfoArg.isSet())
234 outputRequired =
false;
235 multiOutputRequired =
false;
238 operation = labelinfo;
240 if(convertArg.isSet())
242 if(!outputArg.isSet())
248 if(filenames.size() != 1)
250 milx::PrintError(
"Argument Error: Only one output is supported for conversion.");
255 outputRequired =
true;
256 multiOutputRequired =
false;
261 if( smoothArg.isSet() || bilateralArg.isSet() || medianArg.isSet() || gradMagArg.isSet() || laplacianArg.isSet() || distancemapArg.isSet() || cropArg.isSet() || maskArg.isSet()
262 || resampleArg.isSet() || matchArg.isSet() || checkerArg.isSet() || thresholdArg.isSet() || OtsuArg.isSet() || rescaleArg.isSet() || invertArg.isSet() || relabelArg.isSet() || addArg.isSet()
263 || diffArg.isSet() || meanArg.isSet() || mergeArg.isSet() || castArg.isSet() || flipArg.isSet() )
266 if(filenames.size() == 1 && (addArg.isSet() || diffArg.isSet() || meanArg.isSet() || mergeArg.isSet()))
268 milx::PrintError(
"Argument Error: Cannot use arithmetic operations on single input.");
272 else if(filenames.size() == 1 && prefixArg.isSet())
274 milx::PrintError(
"Argument Error: Cannot use prefix argument on single input.");
278 else if(filenames.size() == 1)
280 outputRequired =
true;
281 multiOutputRequired =
false;
283 else if(filenames.size() > 1 && (addArg.isSet() || diffArg.isSet() || meanArg.isSet() || mergeArg.isSet()))
285 outputRequired =
true;
286 multiOutputRequired =
false;
288 else if(outputArg.isSet() && filenames.size() > 1)
290 milx::PrintError(
"Argument Error: Use Output Prefix (-p) for multiple inputs.");
294 else if(!prefixArg.isSet() && filenames.size() > 1)
296 milx::PrintError(
"Argument Error: Output Prefix (-p) must be provided for multiple inputs.");
302 if(smoothArg.isSet())
304 if(bilateralArg.isSet())
305 operation = bilateral;
306 if(medianArg.isSet())
308 if(gradMagArg.isSet())
310 if(laplacianArg.isSet())
311 operation = laplacian;
312 if(distancemapArg.isSet())
313 operation = distancemap;
314 if(thresholdArg.isSet())
315 operation = threshold;
320 if(resampleArg.isSet())
321 operation = resample;
324 if(checkerArg.isSet())
328 if(rescaleArg.isSet())
330 if(invertArg.isSet())
332 if(relabelArg.isSet())
347 if(aboveArg.isSet() || belowArg.isSet())
349 if(!thresholdArg.isSet() && !rescaleArg.isSet())
351 milx::PrintError(
"Argument Error: Another argument (such as threshold) must be provided.");
356 if(labelsArg.isSet())
358 if(!OtsuArg.isSet() && infoArg.isSet())
360 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members 361 milx::PrintError(
"Argument Warning: Another argument (such as Otsu) not provided. Printing label info instead.");
362 operation = labelinfo;
364 milx::PrintError(
"Argument Warning: Another argument (such as Otsu) not provided and ITK version not sufficient for printing label info. Exiting.");
369 if(iterationsArg.isSet())
371 if(!smoothArg.isSet())
373 milx::PrintError(
"Argument Error: Another argument (such as smoothing) must be provided.");
380 if(!bilateralArg.isSet())
382 milx::PrintError(
"Argument Error: Another argument (such as bilateral) must be provided.");
387 if(paddingArg.isSet())
391 milx::PrintError(
"Argument Error: Another argument (such as crop) must be provided.");
398 if(flipAxis < 0 || flipAxis > 2)
400 milx::PrintError(
"Argument Error: Incorrect value provided for axis flipping.");
405 if(thresholdArg.isSet() || rescaleArg.isSet())
407 if( (!aboveArg.isSet() || !belowArg.isSet()) && rescaleArg.isSet() )
409 milx::PrintError(
"Argument Error: Above and below argument(s) must be provided.");
415 if( (!aboveArg.isSet() && !belowArg.isSet()) && !binaryArg.isSet() )
417 milx::PrintError(
"Argument Error: Either above or below argument(s) must be provided.");
421 if( (!aboveArg.isSet() || !belowArg.isSet() || !insideArg.isSet()) && binaryArg.isSet() )
423 milx::PrintError(
"Argument Error: The inside, above and below argument(s) must be provided.");
430 std::cout <<
"Total Images: " << filenames.size() << std::endl;
431 if(filenames.empty())
436 for(stringiterator name = filenames.begin(); name != filenames.end(); name ++)
437 std::cout << *name <<
", ";
438 std::cout << std::endl;
442 std::cerr <<
"Reading Header for type info etc." << std::endl;
443 std::string pixelType, componentType;
444 size_t dimensions = 3;
447 milx::PrintError(
"Failed Reading First Image. Check the image type/file. Exiting.");
450 if(infoArg.isSet() || labelInfoArg.isSet())
457 std::cerr <<
"Reading Images... ";
458 std::vector< itk::SmartPointer<vectorImageType> > vectorCollection;
459 std::vector< itk::SmartPointer<charImageType> > labelledCollection;
460 std::vector< itk::SmartPointer<floatImageType> > collection;
461 bool labelledImages =
false, vectorImages =
false;
462 if(pixelType ==
"vector" || dimensions > 3)
465 if( !milx::File::OpenImages<vectorImageType>(filenames, vectorCollection) )
471 std::cout <<
"Read " << vectorCollection.size() <<
" vector images" << std::endl;
473 #if ITK_MAJOR_VERSION > 3 474 if(!infoArg.isSet() && !maskArg.isSet() && !addArg.isSet() && !diffArg.isSet() && !meanArg.isSet())
476 if(!infoArg.isSet() && !addArg.isSet() && !diffArg.isSet() && !meanArg.isSet())
479 milx::PrintError(
"Input Error: Operation provided not supported for vector images yet.");
483 else if(componentType ==
"unsigned_char" || componentType ==
"unsigned char")
486 if( !milx::File::OpenImages<charImageType>(filenames, labelledCollection) )
491 labelledImages =
true;
492 std::cout <<
"Read " << labelledCollection.size() <<
" labels" << std::endl;
497 if( !milx::File::OpenImages<floatImageType>(filenames, collection) )
502 std::cout <<
"Read " << collection.size() <<
" images" << std::endl;
505 charImageType::Pointer maskImage;
506 if(cropArg.isSet() || maskArg.isSet())
508 if(!milx::File::OpenImage<charImageType>(maskName, maskImage))
513 std::cout <<
"Read " << maskName <<
" as mask" << std::endl;
515 std::cerr <<
"Done" << std::endl;
519 vectorImageType::Pointer vecResult;
520 charImageType::Pointer charResult;
521 floatImageType::Pointer floatResult;
522 std::cerr <<
"Applying... ";
535 #if ITK_MAJOR_VERSION > 3 562 else if(labelledImages)
574 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) 579 std::vector<unsigned char> allValues;
580 for(
size_t k = 0; k < labelledCollection.size(); k ++)
585 for(
size_t j = 0; j < values.size(); j ++)
587 allValues.push_back(values[j]);
588 std::cout << static_cast<unsigned>(values[j]) <<
", ";
590 std::cout << std::endl;
593 for(
size_t j = 0; j < allValues.size(); j ++)
594 std::cout << static_cast<unsigned>(allValues[j]) <<
", ";
595 std::cout << std::endl;
615 labelledImages =
false;
637 const bool binary =
false, signedDistance =
true, insideDistance =
false, squaredDistance =
false;
641 labelledImages =
false;
646 if(aboveArg.isSet() && !belowArg.isSet())
651 else if(!aboveArg.isSet() && belowArg.isSet())
656 else if(binaryArg.isSet())
675 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members 686 charImageType::Pointer referenceImage;
687 if(resampleArg.isSet())
689 if(!milx::File::OpenImage<charImageType>(resampleName, referenceImage))
694 std::cout <<
"Read " << resampleName <<
" as the reference image for resampling" << std::endl;
702 charImageType::Pointer referenceImage;
705 if(!milx::File::OpenImage<charImageType>(matchName, referenceImage))
710 std::cout <<
"Read " << matchName <<
" as the reference image for matching" << std::endl;
718 charImageType::Pointer referenceImage;
719 if(checkerArg.isSet())
721 if(!milx::File::OpenImage<charImageType>(checkerName, referenceImage))
726 std::cout <<
"Read " << checkerName <<
" as the reference image for checkerboarding" << std::endl;
742 labelledImages =
false;
747 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members 754 labelledCollection.clear();
755 labelledImages =
false;
761 else if(flipAxis == 1)
775 std::cerr <<
"Done" << std::endl;
789 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) 792 milx::PrintWarning(
"Float images found and will be cast to 8-bit images for labelling info.");
798 std::vector<unsigned char> allValues;
799 for(
size_t k = 0; k < labelledCollection.size(); k ++)
804 for(
size_t j = 0; j < values.size(); j ++)
806 allValues.push_back(values[j]);
807 std::cout << static_cast<unsigned>(values[j]) <<
", ";
809 std::cout << std::endl;
812 for(
size_t j = 0; j < allValues.size(); j ++)
813 std::cout << static_cast<unsigned>(allValues[j]) <<
", ";
814 std::cout << std::endl;
828 milx::PrintError(
"Failed Relabelling. Only applicable to Labelled images. Exiting.");
853 const bool binary =
false, signedDistance =
true, insideDistance =
false, squaredDistance =
false;
861 if(aboveArg.isSet() && !belowArg.isSet())
866 else if(!aboveArg.isSet() && belowArg.isSet())
871 else if(binaryArg.isSet())
875 labelledImages =
true;
888 labelledImages =
true;
893 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members 905 floatImageType::Pointer referenceImage;
906 if(resampleArg.isSet())
908 if(!milx::File::OpenImage<floatImageType>(resampleName, referenceImage))
913 std::cout <<
"Read " << resampleName <<
" as the reference image for resampling" << std::endl;
921 floatImageType::Pointer referenceImage;
924 if(!milx::File::OpenImage<floatImageType>(matchName, referenceImage))
929 std::cout <<
"Read " << matchName <<
" as the reference image for matching" << std::endl;
937 floatImageType::Pointer referenceImage;
938 if(checkerArg.isSet())
940 if(!milx::File::OpenImage<floatImageType>(checkerName, referenceImage))
945 std::cout <<
"Read " << checkerName <<
" as the reference image for checkerboarding" << std::endl;
964 #if (ITK_REVIEW || ITK_VERSION_MAJOR > 3) //Review only members 969 labelledImages =
true;
976 labelledImages =
true;
982 else if(flipAxis == 1)
996 std::cerr <<
"Done" << std::endl;
999 if(outputArg.isSet() && filenames.size() == 1)
1002 vecResult = vectorCollection[0];
1004 charResult = labelledCollection[0];
1006 floatResult = collection[0];
1015 milx::File::SaveImage<vectorImageType>(outputName, vecResult);
1017 if(multiOutputRequired)
1019 if(!vectorCollection.empty())
1021 const int N = vectorCollection.size();
1024 std::vector<std::string> names;
1027 for(stringiterator filename = filenames.begin(); filename != filenames.end() && n < N; filename ++, n ++)
1030 names.push_back(prefixName + milx::File::GetBaseName(*filename) +
"." + ext);
1031 milx::PrintInfo(
"Will be writing " + prefixName + milx::File::GetBaseName(*filename) +
"." + ext);
1034 milx::File::SaveImages<vectorImageType>(names, vectorCollection);
1042 else if(labelledImages)
1047 milx::File::SaveImage<charImageType>(outputName, charResult);
1049 if(multiOutputRequired)
1051 if(!labelledCollection.empty())
1053 const int N = labelledCollection.size();
1055 milx::PrintInfo(
"Writing labelled results with prefix " + prefixName);
1056 std::vector<std::string> names;
1059 for(stringiterator filename = filenames.begin(); filename != filenames.end() && n < N; filename ++, n ++)
1062 names.push_back(prefixName + milx::File::GetBaseName(*filename) +
"." + ext);
1063 milx::PrintInfo(
"Will be writing " + prefixName + milx::File::GetBaseName(*filename) +
"." + ext);
1066 milx::File::SaveImages<charImageType>(names, labelledCollection);
1079 milx::File::SaveImage<floatImageType>(outputName, floatResult);
1081 if(multiOutputRequired)
1083 if(!collection.empty())
1085 const int N = collection.size();
1088 std::vector<std::string> names;
1091 for(stringiterator filename = filenames.begin(); filename != filenames.end() && n < N; filename ++, n ++)
1094 names.push_back(prefixName + milx::File::GetBaseName(*filename) +
"." + ext);
1095 milx::PrintInfo(
"Will be writing " + prefixName + milx::File::GetBaseName(*filename) +
"." + ext);
1098 milx::File::SaveImages<floatImageType>(names, collection);
1109 return EXIT_SUCCESS;
static void FlipCollection(std::vector< typename itk::SmartPointer< TImage > > &images, bool xAxis=false, bool yAxis=true, bool zAxis=false, bool aboutOrigin=true)
Batch process images by flipping each image along axis provided.
static std::string ExtractFilename(const std::string &filename, char delimiter='/')
Returns filename (with extension) with paths removed.
static void MedianCollection(std::vector< typename itk::SmartPointer< TImage > > &images, const int radius)
Batch process images by smoothing each image using the Median of the neighbourhood.
void PrintError(const std::string msg)
Displays a generic msg to standard error with carriage return.
static void ThresholdAboveCollection(std::vector< typename itk::SmartPointer< TImage > > &images, float outsideValue, float aboveValue)
Batch process images by thresholding each image from above.
This program Animates image slices and animates surfaces in the model view for creating movies...
static void ThresholdCollection(std::vector< typename itk::SmartPointer< TImage > > &images, float outsideValue, float belowValue, float aboveValue)
Batch process images by thresholding each image within band provided.
static void BilateralCollection(std::vector< typename itk::SmartPointer< TImage > > &images, float sigmaRange, float sigmaSpatial)
Batch process images by bilateral smoothing each image.
Represents an image (i.e. an regular rectangular array with scalar values) and their common operation...
static void ThresholdBelowCollection(std::vector< typename itk::SmartPointer< TImage > > &images, float outsideValue, float belowValue)
Batch process images by thresholding each image from below.
void PrintWarning(const std::string msg)
Displays a generic msg to standard output with carriage return.
static void InvertIntensityCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Batch process images by inverting the intensities for each image.
static itk::SmartPointer< TImage > AddCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Batch process images by the adding the images together (pixel-wise).
void PrintInfo(const std::string msg)
Displays a generic msg to standard output with carriage return.
std::string NumberToString(double num, unsigned zeroPad=0)
Number to string converter.
static itk::SmartPointer< TImage > AverageVectorCollection(std::vector< typename itk::SmartPointer< TImage > > &images, int numberOfComponents)
Batch process images by the averaging the vector images (pixel-wise).
static itk::SmartPointer< TImage > DifferenceCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Same as SubtractCollection.
int main(int argc, char *argv[])
static bool ReadImageInformation(const std::string filename, std::string &pixeltype, std::string &componentType, size_t &dimensions)
Reads just the header of an image file (without reading the image data), and writes the info into the...
static void RelabelCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Batch process images by relabelling unconnected regions consecutatively.
static void InformationCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Batch process images by output the image information for each image.
static void GradientMagnitudeCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Batch process images by hightlighting the edges of each image using Gradient magnitude information of...
static std::string GetFileExtension(const std::string &filename)
Returns the file extension (in lower case) of the given filename.
unsigned NumberOfProcessors()
Number of processors or cores on the machine.
static void LaplacianCollection(std::vector< typename itk::SmartPointer< TImage > > &images)
Batch process images by hightlighting the edges of each image using the Laplacian of the image...
static void CheckerboardCollection(std::vector< typename itk::SmartPointer< TImage > > &images, itk::SmartPointer< TImage > refImage, const int squares=10)
Batch process images by checkerboarding all of the images to the reference image provided.
static void MatchHistogramCollection(std::vector< typename itk::SmartPointer< TImage > > &images, itk::SmartPointer< TImage > refImage, const int bins=128)
Batch process images by matching the histograms of the images to the reference image provided...