--- /dev/null
+mkdir run.merge
+for i in $(ls -d results.????)
+do
+ ln -s ../$i run.merge/output_${i}
+done
+gate_power_merge.sh run.merge
+
local outputfile="${1:?"provide output filename"}"
echo "merging ${outputfile}"
- local partialoutputfiles="$(find "${rundir}" -mindepth 2 -type f -name "${outputfile}")"
+ local partialoutputfiles="$(find -L "${rundir}" -mindepth 2 -type f -name "${outputfile}")"
local nboutputfiles="$(echo "${partialoutputfiles}" | wc -l)"
if test ${nboutputdirs} -ne ${nboutputfiles}
then
local indent=" ** "
local outputfile="${1:?"provide output filename"}"
- local partialoutputfiles="$(find "${rundir}" -mindepth 2 -type f -name "${outputfile}")"
+ local partialoutputfiles="$(find -L "${rundir}" -mindepth 2 -type f -name "${outputfile}")"
local nboutputfiles="$(echo "${partialoutputfiles}" | wc -l)"
if test ${nboutputdirs} -ne ${nboutputfiles}
then
echo "${indent}${squared_merged_file} found"
## search for NumberOfEvent
totalEvents=0;
- for outputfile in $(find "${rundir}" -regextype 'posix-extended' -type f -regex "${rundir}/output.*\.(hdr|mhd|mha|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
+ for outputfile in $(find -L "${rundir}" -regextype 'posix-extended' -type f -regex "${rundir}/output.*\.(hdr|mhd|mha|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
do
#echo $outputfile
if grep -q 'NumberOfEvent' "${outputdir}/${outputfile}"
rundir="${1?"provide run dir"}"
rundir="$(echo "${rundir}" | sed 's|/*$||')"
-nboutputdirs="$(find "${rundir}" -mindepth 1 -type d -name 'output*' | wc -l)"
+nboutputdirs="$(find "${rundir}" -mindepth 1 -type d -o -type l -name 'output*' | wc -l)"
test ${nboutputdirs} -gt 0 || error "no output dir found"
echo "found ${nboutputdirs} partial output dirs"
test -d "${outputdir}" && rm -r "${outputdir}"
mkdir "${outputdir}"
-
-for outputfile in $(find "${rundir}" -regextype 'posix-extended' -type f -regex "${rundir}/output.*\.(hdr|mhd|mha|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
+ls ${rundir}/
+for outputfile in $(find -L "${rundir}" -regextype 'posix-extended' -type f -regex "${rundir}/output.*\.(hdr|mhd|mha|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
do
merge_dispatcher "${outputfile}"
done
echo ""
echo "Merging done. Special case for statistical uncertainty"
-for outputfile in $(find "${outputdir}" -regextype 'posix-extended' -type f -regex "${outputdir}/.*\.(hdr|mhd|mha|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
+for outputfile in $(find -L "${outputdir}" -regextype 'posix-extended' -type f -regex "${outputdir}/.*\.(hdr|mhd|mha|root|txt)" | awk -F '/' '{ print $NF; }' | sort | uniq)
do
merge_dispatcher_uncertainty "${outputfile}"
done
TARGET_LINK_LIBRARIES(clitkMatrixToElastixTransform clitkCommon )
SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMatrixToElastixTransform)
+ WRAP_GGO(clitkMatrixMultiply_GGO_C clitkMatrixMultiply.ggo)
+ ADD_EXECUTABLE(clitkMatrixMultiply clitkMatrixMultiply.cxx ${clitkMatrixMultiply_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkMatrixMultiply clitkCommon )
+ SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMatrixMultiply)
+
WRAP_GGO(clitkMatrixInverse_GGO_C clitkMatrixInverse.ggo)
ADD_EXECUTABLE(clitkMatrixInverse clitkMatrixInverse.cxx ${clitkMatrixInverse_GGO_C})
TARGET_LINK_LIBRARIES(clitkMatrixInverse clitkCommon )
filter->SetInputFilenames(l);
filter->SetIOVerbose(args_info.verbose_flag);
filter->SetOutputFilename(output);
+ filter->SetVV(args_info.vv_flag);
filter->EnableWriteCompression(args_info.compression_flag);
if (args_info.type_given) filter->SetOutputPixelType(args_info.type_arg);
version "1.0"
purpose "Convert an image into another image.\n\tAllow to change the file format and/or the pixel type. \n\tKnown file formats 2D: jpeg png bmp tif mhd hdr vox dcm \n\tKnown file formats 3D: mhd vox hdr dcm\n\tKnown file formats 4D: mhd \n\tKnown images: 2D 3D or 4D, schar, uchar, short, ushort, int, float and double\n\nIf the -o option is not given, the last parameter of the command line is used as output."
-option "config" - "Config file" string no
-option "input" i "Input image filename" string no
-option "output" o "Output image filename" string no
-option "type" t "Output type (float, ushort ...)" string no
-option "verbose" v "Verbose" flag off
-option "compression" c "Compress output" flag off
+option "config" - "Config file" string no
+option "input" i "Input image filename" string no
+option "output" o "Output image filename" string no
+option "type" t "Output type (float, ushort ...)" string no
+option "verbose" v "Verbose" flag off
+option "compression" c "Compress output" flag off
+option "vv" - "Read image as in vv and save transform in meta information" flag off
#define CLITKIMAGECONVERTGENERICFILTER_CXX
#include "clitkImageConvertGenericFilter.h"
+#include "vvImageReader.h"
+#include "vvImageWriter.h"
//--------------------------------------------------------------------
clitk::ImageConvertGenericFilter::ImageConvertGenericFilter():
}
}
- if ((m_PixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) {
+ if(mVV) {
+ if (mOutputPixelTypeName != "NotSpecified" || m_WriteCompression) {
+ std::cerr << "--vv is not compatible with --compression and --type options." << std::endl;
+ exit(-1);
+ }
+
+ vvImageReader::Pointer reader = vvImageReader::New();
+ reader->SetInputFilenames(m_InputFilenames);
+ reader->Update(vvImageReader::IMAGE);
+
+ vvImageWriter::Pointer writer = vvImageWriter::New();
+ writer->SetOutputFileName(m_OutputFilenames.front());
+ writer->SetSaveTransform(true);
+ writer->SetInput(reader->GetOutput());
+ writer->Update();
+ return;
+ }
+ else if ((m_PixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) {
typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
this->SetNextOutput<InputImageType>(input);
} else {
std::string GetInputPixelTypeName() { return m_PixelTypeName; }
std::string GetOutputPixelTypeName() { return mOutputPixelTypeName; }
void SetOutputPixelType(std::string p) { mOutputPixelTypeName = p; }
+ void SetVV(bool b) { mVV = b; }
bool IsWarningOccur() { return mWarningOccur; }
std::string & GetWarning() { return mWarning; }
void EnableDisplayWarning(bool b) { mDisplayWarning = b; }
std::string mWarning;
bool mWarningOccur;
bool mDisplayWarning;
+ bool mVV;
private:
template <class InputImageType, bool isVector>
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+// clitk
+#include "clitkMatrixMultiply_ggo.h"
+#include "clitkTransformUtilities.h"
+#include "clitkIO.h"
+#include "clitkMatrix.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+ // Init command line
+ GGO(clitkMatrixMultiply, args_info);
+ CLITK_INIT;
+
+ // Read matrix
+ itk::Matrix<double, 4, 4> matrix1, matrix2;
+ try {
+ matrix1 = clitk::ReadMatrix3D(args_info.input1_arg);
+ matrix2 = clitk::ReadMatrix3D(args_info.input2_arg);
+ }
+ catch (itk::ExceptionObject & err) {
+ std::cerr << "Error reading "
+ << args_info.input1_arg
+ << " and "
+ << args_info.input2_arg
+ << std::endl;
+ std::cerr << err.GetDescription() << std::endl;
+ exit(-1);
+ }
+
+ itk::Matrix<double, 4, 4> matrix(matrix2.GetVnlMatrix() * matrix1.GetVnlMatrix());
+
+ // Print matrix
+ std::ofstream os;
+ clitk::openFileForWriting(os, args_info.output_arg);
+ os << clitk::Get4x4MatrixDoubleAsString(matrix, 16);
+ os.close();
+
+ return EXIT_SUCCESS;
+}// end main
+
+//--------------------------------------------------------------------
--- /dev/null
+package "clitkMatrixMultiply"
+version "1.0"
+purpose "Multiply two 4x4 matrices. In matrice notations, does input2*input"
+
+option "config" - "Config file" string optional
+option "input1" i "Input matrix filename" string required
+option "input2" j "Input matrix filename" string required
+option "output" o "Output matrix filename" string required