- std::vector<int> sliceIndex;
- clitk::GetSortedIndex(locs, sliceIndex);
+ std::vector<int> sliceIndex(files.size());
+ //clitk::GetSortedIndex(locs, sliceIndex);
+ //Look for files into GDCMSeriesFileNames, because it sorts files correctly and take the order
+ const std::vector<std::string> & temp = nameGenerator->GetFileNames(*sn);
+ for(unsigned int i=0; i<files.size(); i++) {
+ int j(0);
+ bool found(false);
+ while (!found && j<temp.size()) {
+ const size_t last_slash_idx2 = temp[j].rfind('/');
+ std::string tempFilename(temp[j]);
+ if (temp[j][0] == '.' && temp[j][1] == '/')
+ tempFilename = temp[j].substr(2, temp[j].size()-1);
+ if (tempFilename == files[i]) {
+ sliceIndex[j] = i;
+ found = true;
+ }
+ ++j;
+ }
+ }
+ if (sliceIndex.size() == 0) { //ie. sn is not a serie present in files
+ sn++;
+ continue;
+ }
+