From 6ee648fb3b3984f5faeda409048999a2bd479bc3 Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Fri, 7 Apr 2017 12:31:30 -0400 Subject: [PATCH 1/3] BUG: fix path creation for bvec & bval computed path Otherwise we end up looking for e.g. /test.bvec which doesn't exist. --- DWIConvert/DWIConverter.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/DWIConvert/DWIConverter.cxx b/DWIConvert/DWIConverter.cxx index e7e5a425f..13ab35fee 100644 --- a/DWIConvert/DWIConverter.cxx +++ b/DWIConvert/DWIConverter.cxx @@ -175,8 +175,11 @@ void DWIConverter::ReadGradientInformation(const std::string& inputBValues, cons if( CheckArg("B Values", inputBValues, "") == EXIT_FAILURE ) { std::vector pathElements; - pathElements.push_back(baseDirectory); - pathElements.push_back("/"); + if (!baseDirectory.empty()) + { + pathElements.push_back(baseDirectory); + pathElements.push_back("/"); + } pathElements.push_back( itksys::SystemTools::GetFilenameWithoutExtension (inputVolumeNameTemplate) + ".bval"); _inputBValues = itksys::SystemTools::JoinPath(pathElements); std::cout << " From template " << inputVolumeNameTemplate << std::endl; @@ -186,8 +189,11 @@ void DWIConverter::ReadGradientInformation(const std::string& inputBValues, cons if( CheckArg("B Vectors", inputBVectors, "") == EXIT_FAILURE ) { std::vector pathElements; - pathElements.push_back(baseDirectory); - pathElements.push_back("/"); + if (!baseDirectory.empty()) + { + pathElements.push_back(baseDirectory); + pathElements.push_back("/"); + } pathElements.push_back( itksys::SystemTools::GetFilenameWithoutExtension(inputVolumeNameTemplate) + ".bvec" ); _inputBVectors = itksys::SystemTools::JoinPath(pathElements); std::cout << " From template " << inputVolumeNameTemplate << std::endl; @@ -695,4 +701,4 @@ double DWIConverter::readThicknessFromDict(){ myValidator.SetMetaDataDictionary(m_Volume->GetMetaDataDictionary()); m_thickness = myValidator.GetThicknesses().at(2); return m_thickness; -} \ No newline at end of file +} From ca7597d004f71d9500b4f081590be4b7b1ec7ddd Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Fri, 7 Apr 2017 13:08:35 -0400 Subject: [PATCH 2/3] STYLE: more style issues for readability --- DWIConvert/DWIConverter.cxx | 2 +- DWIConvert/SiemensDWIConverter.cxx | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/DWIConvert/DWIConverter.cxx b/DWIConvert/DWIConverter.cxx index 13ab35fee..d1b3400f7 100644 --- a/DWIConvert/DWIConverter.cxx +++ b/DWIConvert/DWIConverter.cxx @@ -292,7 +292,7 @@ std::string DWIConverter::MakeFileComment( << "# part of the BRAINSTools package." << std::endl << "# Command line options:" << std::endl << "# --inputFileType " << inputFileType << std::endl; - if( std::abs( smallGradientThreshold- 0.2 ) > 1e-4 ) + if( std::abs( smallGradientThreshold - 0.2 ) > 1e-4 ) { commentSection << "# --smallGradientThreshold " << smallGradientThreshold << std::endl; } diff --git a/DWIConvert/SiemensDWIConverter.cxx b/DWIConvert/SiemensDWIConverter.cxx index f45dc3119..7c54d2c61 100644 --- a/DWIConvert/SiemensDWIConverter.cxx +++ b/DWIConvert/SiemensDWIConverter.cxx @@ -4,17 +4,18 @@ #include "SiemensDWIConverter.h" SiemensDWIConverter::SiemensDWIConverter (DWIDICOMConverterBase::DCMTKFileVector &allHeaders, -DWIConverter::FileNamesContainer &inputFileNames, -const bool useBMatrixGradientDirections, -const bool FSLFileFormatHorizontalBy3Rows, -const double smallGradientThreshold) : DWIDICOMConverterBase(allHeaders,inputFileNames, - useBMatrixGradientDirections, - FSLFileFormatHorizontalBy3Rows), -m_SmallGradientThreshold(smallGradientThreshold), -m_MMosaic(0), -m_NMosaic(0), -m_Stride(0), -m_HasCSAHeader(false) + DWIConverter::FileNamesContainer &inputFileNames, + const bool useBMatrixGradientDirections, + const bool FSLFileFormatHorizontalBy3Rows, + const double smallGradientThreshold) : + DWIDICOMConverterBase(allHeaders,inputFileNames, + useBMatrixGradientDirections, + FSLFileFormatHorizontalBy3Rows), + m_SmallGradientThreshold(smallGradientThreshold), + m_MMosaic(0), + m_NMosaic(0), + m_Stride(0), + m_HasCSAHeader(false) { } From ae6a9988cd303595c8aaa7ec00703e6e5d86b7bf Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Fri, 7 Apr 2017 13:09:17 -0400 Subject: [PATCH 3/3] BUG: fix swapped argument order in call to constructor was leading to inaccurate conversion failure message --- DWIConvert/DWIConverterFactory.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DWIConvert/DWIConverterFactory.cxx b/DWIConvert/DWIConverterFactory.cxx index f8cca8582..0febc6b7f 100644 --- a/DWIConvert/DWIConverterFactory.cxx +++ b/DWIConvert/DWIConverterFactory.cxx @@ -177,7 +177,8 @@ DWIConverter* DWIConverterFactory::New() { converter = new SiemensDWIConverter(m_Headers,m_InputFileNames, m_UseBMatrixGradientDirections, - m_SmallGradientThreshold, m_FSLFileFormatHorizontalBy3Rows); + m_FSLFileFormatHorizontalBy3Rows, + m_SmallGradientThreshold); } else if(StringContains(this->m_Vendor,"GE")) { @@ -199,4 +200,4 @@ DWIConverter* DWIConverterFactory::New() } return converter; } -std::string DWIConverterFactory::GetVendor() { return m_Vendor; } \ No newline at end of file +std::string DWIConverterFactory::GetVendor() { return m_Vendor; }