fix(TMTV): The TMTV CSV file now has the correct name and contents (#5215)
This commit is contained in:
1 parent
fceb515a68
commit
522d2aa764
9 files changed
+94
-5
No files matched your search
@@ -78,6 +78,7 @@ export default function PanelRoiThresholdSegmentation() {
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Button
|
||||
dataCY="exportTmtvCsvReport"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="text-blue-500"
|
||||
|
||||
@@ -362,7 +362,9 @@ const commandsModule = ({ servicesManager, commandsManager, extensionManager }:
|
||||
}
|
||||
|
||||
const referencedVolume =
|
||||
csTools.utilities.segmentation.getReferenceVolumeForSegmentationVolume(segmentationId);
|
||||
csTools.utilities.segmentation.getReferenceVolumeForSegmentationVolume(
|
||||
labelmapVolume.volumeId
|
||||
);
|
||||
|
||||
if (!referencedVolume) {
|
||||
report[id] = segReport;
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
export default function createAndDownloadTMTVReport(segReport, additionalReportRows, options = {}) {
|
||||
const firstReport = segReport[Object.keys(segReport)[0]];
|
||||
const columns = Object.keys(firstReport);
|
||||
const csv = [columns.join(',')];
|
||||
const csv = [
|
||||
columns
|
||||
.map(column =>
|
||||
column.toLowerCase().startsWith('namedstats_') ? column.substring(11) : column
|
||||
)
|
||||
.join(','),
|
||||
];
|
||||
|
||||
Object.values(segReport).forEach(segmentation => {
|
||||
const row = [];
|
||||
columns.forEach(column => {
|
||||
// if it is array then we need to replace , with space to avoid csv parsing error
|
||||
row.push(
|
||||
Array.isArray(segmentation[column]) ? segmentation[column].join(' ') : segmentation[column]
|
||||
segmentation[column] && typeof segmentation[column] === 'object'
|
||||
? Array.isArray(segmentation[column])
|
||||
? segmentation[column].join(' ')
|
||||
: segmentation[column].value && Array.isArray(segmentation[column].value)
|
||||
? segmentation[column].value.join(' ')
|
||||
: (segmentation[column].value ?? segmentation[column])
|
||||
: segmentation[column]
|
||||
);
|
||||
});
|
||||
csv.push(row.join(','));
|
||||
|
||||
Reference in new issue
Block a user