Skip to content

Commit 93a7385

Browse files
committed
compiling properly now
1 parent 31bf2ee commit 93a7385

File tree

7 files changed

+119
-119
lines changed

7 files changed

+119
-119
lines changed

12_UnitTesting/code/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ INCLUDE( ${ITK_USE_FILE} )
1414
ADD_EXECUTABLE(
1515
${EXE_NAME}
1616
${PROJECT_SOURCE_DIR}/src/BasicApp.h
17-
${PROJECT_SOURCE_DIR}/src/cbicaITKWriteImage.h
17+
${PROJECT_SOURCE_DIR}/src/cbicaITKSafeImageIO.h
1818
${PROJECT_SOURCE_DIR}/src/cbicaUtilities.h
1919
${PROJECT_SOURCE_DIR}/src/cbicaUtilities.cpp
2020
${PROJECT_SOURCE_DIR}/src/cbicaCmdParser.h

12_UnitTesting/code/src/cbicaCmdParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static const char cSeparator = '/';
5151
#include <algorithm>
5252
#include <string>
5353
#include "cbicaCmdParser.h"
54-
#include "yaml-cpp/yaml.h"
54+
//#include "yaml-cpp/yaml.h"
5555

5656
#ifndef PROJECT_VERSION
5757
#define PROJECT_VERSION "0.0.1"

12_UnitTesting/code/src/cbicaITKSafeImageIO.h

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ See COPYING file or https://www.cbica.upenn.edu/sbia/software/license.html
2525
#include "itkNiftiImageIO.h"
2626
#include "itkGDCMImageIO.h"
2727
#include "itkGDCMSeriesFileNames.h"
28-
#include "itkDCMTKImageIO.h"
29-
#include "itkDCMTKSeriesFileNames.h"
28+
//#include "itkDCMTKImageIO.h"
29+
//#include "itkDCMTKSeriesFileNames.h"
3030
#include "itkNumericSeriesFileNames.h"
3131
#include "itkOrientImageFilter.h"
3232
#include "itkChangeInformationImageFilter.h"
@@ -39,8 +39,8 @@ See COPYING file or https://www.cbica.upenn.edu/sbia/software/license.html
3939
#endif
4040

4141
#include "cbicaUtilities.h"
42-
#include "cbicaITKImageInfo.h"
43-
#include "cbicaITKUtilities.h"
42+
//#include "cbicaITKImageInfo.h"
43+
//#include "cbicaITKUtilities.h"
4444

4545
using ImageTypeFloat3D = itk::Image< float, 3 >;
4646
using TImageType = ImageTypeFloat3D;
@@ -160,90 +160,90 @@ namespace cbica
160160
return reader;
161161
}
162162

163-
/**
164-
\brief Returns the unique series IDs in the specified directory
165-
166-
The check is only done on the DICOM tag provided, so if there are series with the same UID information (but are indeed different images),
167-
this function will not able to handle it.
168-
169-
\param dirName The directory in question
170-
\param tagToCheck The tag on the basis of which the test is done; defaults to "0x0020|0x00E"
171-
\return Vector of Series UIDs and fileName collection pairs, with each fileName collection corresponding to a UID
172-
*/
173-
std::vector< std::pair< std::string , std::vector< std::string > > > GetDICOMSeriesAndFilesInDir(const std::string &dirName,
174-
const std::string tagToCheck = "0x0020|0x00E")
175-
{
176-
std::vector<
177-
std::pair<
178-
std::string, // this is the series UID information
179-
std::vector< std::string > > // these are the fileNames corresponding to each UID
180-
> returnVector;
181-
182-
auto dirName_wrap = cbica::normPath(dirName);
183-
auto allFilesInDir = cbica::filesInDirectory(dirName_wrap);
184-
185-
// initialize the returnVector with the first series UID and fileName
186-
returnVector.push_back(
187-
std::make_pair(cbica::GetDICOMTagValue(allFilesInDir[0], tagToCheck), // get the first series UID
188-
std::vector< std::string >({ allFilesInDir[0] }) // construct a initial vector
189-
));
190-
191-
std::vector< std::string > volumeSeries;
192-
const std::string volumeSeriesTag = "0x0018|0x1030";
193-
volumeSeries.push_back(cbica::GetDICOMTagValue(allFilesInDir[0], volumeSeriesTag));
194-
195-
// looping through all the found files
196-
for (size_t i = 1; i < allFilesInDir.size(); i++)
197-
{
198-
auto temp = cbica::GetDICOMTagValue(allFilesInDir[i], tagToCheck);
199-
auto temp_volSeries = cbica::GetDICOMTagValue(allFilesInDir[i], volumeSeriesTag);
200-
201-
bool newUIDFound = true;
202-
for (size_t j = 0; j < returnVector.size(); j++)
203-
{
204-
if (returnVector[j].first == temp)
205-
{
206-
bool newVolSeriesFound = true;
207-
for (size_t k = 0; k < volumeSeries.size(); k++)
208-
{
209-
if (volumeSeries[k] == temp_volSeries)
210-
{
211-
newVolSeriesFound = false;
212-
}
213-
}
214-
if (!newVolSeriesFound)
215-
{
216-
returnVector[j].second.push_back(allFilesInDir[i]);
217-
newUIDFound = false;
218-
break;
219-
}
220-
else
221-
{
222-
volumeSeries.push_back(temp_volSeries); // the new volume has same series UID information so nothing changes there
223-
}
224-
}
225-
}
226-
if (newUIDFound)
227-
{
228-
// add a new seriesUID-fileNames pair
229-
returnVector.push_back(
230-
std::make_pair(temp, // this is the UID
231-
std::vector< std::string >({ allFilesInDir[i] }) // first filename corresponding to the UID
232-
));
233-
}
234-
}
235-
236-
return returnVector;
237-
238-
//// this implementation takes a *lot* of time
239-
//auto dicomIO = itk::DCMTKImageIO::New();
240-
//auto inputNames = itk::DCMTKSeriesFileNames::New();
241-
//inputNames->SetInputDirectory(dirName_wrap);
242-
//inputNames->SetLoadPrivateTags(true);
243-
//auto UIDs = inputNames->GetSeriesUIDs(); // this is the primary bottle-neck, I think because it does checks on multiple different things
244-
245-
//return cbica::GetUniqueElements< std::string >(UIDs);
246-
}
163+
///**
164+
//\brief Returns the unique series IDs in the specified directory
165+
166+
//The check is only done on the DICOM tag provided, so if there are series with the same UID information (but are indeed different images),
167+
//this function will not able to handle it.
168+
169+
//\param dirName The directory in question
170+
//\param tagToCheck The tag on the basis of which the test is done; defaults to "0x0020|0x00E"
171+
//\return Vector of Series UIDs and fileName collection pairs, with each fileName collection corresponding to a UID
172+
//*/
173+
//std::vector< std::pair< std::string , std::vector< std::string > > > GetDICOMSeriesAndFilesInDir(const std::string &dirName,
174+
// const std::string tagToCheck = "0x0020|0x00E")
175+
//{
176+
// std::vector<
177+
// std::pair<
178+
// std::string, // this is the series UID information
179+
// std::vector< std::string > > // these are the fileNames corresponding to each UID
180+
// > returnVector;
181+
182+
// auto dirName_wrap = cbica::normPath(dirName);
183+
// auto allFilesInDir = cbica::filesInDirectory(dirName_wrap);
184+
//
185+
// // initialize the returnVector with the first series UID and fileName
186+
// returnVector.push_back(
187+
// std::make_pair(cbica::GetDICOMTagValue(allFilesInDir[0], tagToCheck), // get the first series UID
188+
// std::vector< std::string >({ allFilesInDir[0] }) // construct a initial vector
189+
// ));
190+
191+
// std::vector< std::string > volumeSeries;
192+
// const std::string volumeSeriesTag = "0x0018|0x1030";
193+
// volumeSeries.push_back(cbica::GetDICOMTagValue(allFilesInDir[0], volumeSeriesTag));
194+
195+
// // looping through all the found files
196+
// for (size_t i = 1; i < allFilesInDir.size(); i++)
197+
// {
198+
// auto temp = cbica::GetDICOMTagValue(allFilesInDir[i], tagToCheck);
199+
// auto temp_volSeries = cbica::GetDICOMTagValue(allFilesInDir[i], volumeSeriesTag);
200+
201+
// bool newUIDFound = true;
202+
// for (size_t j = 0; j < returnVector.size(); j++)
203+
// {
204+
// if (returnVector[j].first == temp)
205+
// {
206+
// bool newVolSeriesFound = true;
207+
// for (size_t k = 0; k < volumeSeries.size(); k++)
208+
// {
209+
// if (volumeSeries[k] == temp_volSeries)
210+
// {
211+
// newVolSeriesFound = false;
212+
// }
213+
// }
214+
// if (!newVolSeriesFound)
215+
// {
216+
// returnVector[j].second.push_back(allFilesInDir[i]);
217+
// newUIDFound = false;
218+
// break;
219+
// }
220+
// else
221+
// {
222+
// volumeSeries.push_back(temp_volSeries); // the new volume has same series UID information so nothing changes there
223+
// }
224+
// }
225+
// }
226+
// if (newUIDFound)
227+
// {
228+
// // add a new seriesUID-fileNames pair
229+
// returnVector.push_back(
230+
// std::make_pair(temp, // this is the UID
231+
// std::vector< std::string >({ allFilesInDir[i] }) // first filename corresponding to the UID
232+
// ));
233+
// }
234+
// }
235+
236+
// return returnVector;
237+
238+
// //// this implementation takes a *lot* of time
239+
// //auto dicomIO = itk::DCMTKImageIO::New();
240+
// //auto inputNames = itk::DCMTKSeriesFileNames::New();
241+
// //inputNames->SetInputDirectory(dirName_wrap);
242+
// //inputNames->SetLoadPrivateTags(true);
243+
// //auto UIDs = inputNames->GetSeriesUIDs(); // this is the primary bottle-neck, I think because it does checks on multiple different things
244+
245+
// //return cbica::GetUniqueElements< std::string >(UIDs);
246+
//}
247247

248248
/**
249249
\brief Get the Dicom image reader (not the image, the READER). This is useful for scenarios where reader meta information is needed for later writing step(s).

12_UnitTesting/code/src/cbicaUtilities.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static const char cSeparator = '/';
6868
#include <thread>
6969

7070
#include "cbicaUtilities.h"
71-
#include "yaml-cpp/yaml.h"
71+
//#include "yaml-cpp/yaml.h"
7272

7373
namespace cbica
7474
{
@@ -518,30 +518,30 @@ namespace cbica
518518
*/
519519
}
520520

521-
bool IsCompatible(const std::string inputVersionFile)
522-
{
523-
auto config = YAML::LoadFile(inputVersionFile);
521+
//bool IsCompatible(const std::string inputVersionFile)
522+
//{
523+
// auto config = YAML::LoadFile(inputVersionFile);
524524

525-
auto currentCollectionVersion = std::stoi(cbica::replaceString(config["Version"].as< std::string >().c_str(), ".", "").c_str());
526-
auto minimumVersion = std::stoi(cbica::replaceString(config["Minimum"].as< std::string >().c_str(), ".", "").c_str());
527-
auto maximumVersion = std::stoi(cbica::replaceString(config["Maximum"].as< std::string >().c_str(), ".", "").c_str());
528-
auto currentPackageVersion = std::stoi(cbica::replaceString(std::string(PROJECT_VERSION), ".", "").c_str());
525+
// auto currentCollectionVersion = std::stoi(cbica::replaceString(config["Version"].as< std::string >().c_str(), ".", "").c_str());
526+
// auto minimumVersion = std::stoi(cbica::replaceString(config["Minimum"].as< std::string >().c_str(), ".", "").c_str());
527+
// auto maximumVersion = std::stoi(cbica::replaceString(config["Maximum"].as< std::string >().c_str(), ".", "").c_str());
528+
// auto currentPackageVersion = std::stoi(cbica::replaceString(std::string(PROJECT_VERSION), ".", "").c_str());
529529

530-
if (currentPackageVersion == currentCollectionVersion)
531-
{
532-
return true;
533-
}
534-
if (currentPackageVersion < minimumVersion)
535-
{
536-
return false;
537-
}
538-
if (currentPackageVersion > maximumVersion)
539-
{
540-
return false;
541-
}
530+
// if (currentPackageVersion == currentCollectionVersion)
531+
// {
532+
// return true;
533+
// }
534+
// if (currentPackageVersion < minimumVersion)
535+
// {
536+
// return false;
537+
// }
538+
// if (currentPackageVersion > maximumVersion)
539+
// {
540+
// return false;
541+
// }
542542

543-
return true;
544-
}
543+
// return true;
544+
//}
545545

546546
size_t getFolderSize(const std::string &rootFolder)
547547
{

12_UnitTesting/code/src/cbicaUtilities.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,12 @@ namespace cbica
354354
*/
355355
size_t getFileSize(const std::string &inputFile);
356356

357-
/*
358-
\brief Checks for the compatibility with the current project
357+
///*
358+
//\brief Checks for the compatibility with the current project
359359

360-
\param inputVersionFile The version file (in YAML) that contains the compatibility information
361-
*/
362-
bool IsCompatible(const std::string inputVersionFile);
360+
//\param inputVersionFile The version file (in YAML) that contains the compatibility information
361+
//*/
362+
//bool IsCompatible(const std::string inputVersionFile);
363363

364364
/**
365365
\brief Get the size of the folder

12_UnitTesting/code/testing/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ADD_EXECUTABLE(
1313
${TEST_EXE_NAME}
1414
testExe.cxx
1515
${PROJECT_SOURCE_DIR}/src/BasicApp.h
16-
${PROJECT_SOURCE_DIR}/src/cbicaITKWriteImage.h
16+
${PROJECT_SOURCE_DIR}/src/cbicaITKSafeImageIO.h
1717
${PROJECT_SOURCE_DIR}/src/cbicaUtilities.h
1818
${PROJECT_SOURCE_DIR}/src/cbicaUtilities.cpp
1919
${PROJECT_SOURCE_DIR}/src/cbicaCmdParser.h

12_UnitTesting/code/testing/testExe.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "cbicaCmdParser.h"
1111
#include "cbicaUtilities.h"
12-
#include "cbicaITKWriteImage.h"
12+
#include "cbicaITKSafeImageIO.h"
1313

1414
#include "BasicApp.h"
1515

0 commit comments

Comments
 (0)