Skip to content

Commit

Permalink
BUG: Fix removal of '-' from patientId
Browse files Browse the repository at this point in the history
The use of std::remove was not correctly implemented.
After removing '-' from the string and shuffling items
forward into the space, the remaining items
in the string need to be explicitly erased.
  • Loading branch information
hjmjohnson committed Apr 11, 2024
1 parent 877acba commit b243803
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/IO/GE/src/itkGE5ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ GE5ImageIO::ReadHeader(const char * FileNameToRead)

// patient id
std::string tmpId(buffer.get() + VOff(84, 88), 13);
(void)std::remove(tmpId.begin(), tmpId.end(), '-');
tmpId.erase(std::remove(tmpId.begin(), tmpId.end(), '-'), tmpId.end());
strncpy(curImage->patientId, tmpId.c_str(), sizeof(curImage->patientId) - 1);
curImage->patientId[sizeof(curImage->patientId) - 1] = '\0';

Expand Down

0 comments on commit b243803

Please sign in to comment.