@@ -25,8 +25,8 @@ See COPYING file or https://www.cbica.upenn.edu/sbia/software/license.html
25
25
#include " itkNiftiImageIO.h"
26
26
#include " itkGDCMImageIO.h"
27
27
#include " itkGDCMSeriesFileNames.h"
28
- #include " itkDCMTKImageIO.h"
29
- #include " itkDCMTKSeriesFileNames.h"
28
+ // #include "itkDCMTKImageIO.h"
29
+ // #include "itkDCMTKSeriesFileNames.h"
30
30
#include " itkNumericSeriesFileNames.h"
31
31
#include " itkOrientImageFilter.h"
32
32
#include " itkChangeInformationImageFilter.h"
@@ -39,8 +39,8 @@ See COPYING file or https://www.cbica.upenn.edu/sbia/software/license.html
39
39
#endif
40
40
41
41
#include " cbicaUtilities.h"
42
- #include " cbicaITKImageInfo.h"
43
- #include " cbicaITKUtilities.h"
42
+ // #include "cbicaITKImageInfo.h"
43
+ // #include "cbicaITKUtilities.h"
44
44
45
45
using ImageTypeFloat3D = itk::Image< float , 3 >;
46
46
using TImageType = ImageTypeFloat3D;
@@ -160,90 +160,90 @@ namespace cbica
160
160
return reader;
161
161
}
162
162
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
+ // }
247
247
248
248
/* *
249
249
\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).
0 commit comments