Skip to content

Commit

Permalink
PIXI-154: Update PCIF naming scheme in the Inveon importer to include…
Browse files Browse the repository at this point in the history
… the timepoint as part of the XNAT session name
  • Loading branch information
andylassiter committed Oct 14, 2024
1 parent d3724e5 commit b881b01
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [PIXI-150]: Update display XML listings for PET and CT to make them more user-friendly.
- [PIXI-152]: Allow for single mouses/rat hotels in the hotel scan record form.
- [PIXI-154]: Update PCIF naming scheme in the Inveon importer to include the timepoint as part of the XNAT session name

## [1.3.0] - 2024-06-24

Expand Down Expand Up @@ -122,4 +123,5 @@ plugins directory and restart XNAT.
[PIXI-150]: https://radiologics.atlassian.net/browse/PIXI-150
[PIXI-151]: https://radiologics.atlassian.net/browse/PIXI-151
[PIXI-152]: https://radiologics.atlassian.net/browse/PIXI-152
[PIXI-153]: https://radiologics.atlassian.net/browse/PIXI-153
[PIXI-153]: https://radiologics.atlassian.net/browse/PIXI-153
[PIXI-154]: https://radiologics.atlassian.net/browse/PIXI-154
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ private String extractSessionLabel(InveonImageRepresentation inveonImageRepresen

case "pcif":
// Special case for internal WUSTL PCIF lab
// First 9 characters of filename
sessionLabel = inveonImageRepresentation.getPixelFileName();

if (StringUtils.isBlank(sessionLabel)) {
Expand All @@ -713,7 +712,21 @@ private String extractSessionLabel(InveonImageRepresentation inveonImageRepresen
if (StringUtils.isBlank(sessionLabel)) {
sessionLabel = UNKNOWN_SESSION_LABEL;
} else {
if (sessionLabel.length() > 9) {
// File name: mpet5013c_ct1_v1.ct.img -> Session label: mpet5013c_1
// File name: mpet5013c_em1_v1.pet.img -> Session label: mpet5013c_1
// File name: mpet5013c_ct2_v1.ct.img -> Session label: mpet5013c_2
// File name: mpet5013c_em2_v1.pet.img -> Session label: mpet5013c_2
// The 1 or 2 is the timepoint

String regex = "(.*)_(ct|em)(\\d+)_v(\\d+).(.*)";
Pattern pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(sessionLabel);

if (matcher.matches() && matcher.groupCount() >= 3) {
String prefix = matcher.group(1);
String timepoint = matcher.group(3);
sessionLabel = prefix + "_" + timepoint;
} else if (sessionLabel.length() > 9) {
sessionLabel = sessionLabel.substring(0, 9);
}
}
Expand Down

0 comments on commit b881b01

Please sign in to comment.