Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CSV Generators #246

Merged
merged 1 commit into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions bin/batchExamples/GenerateInputCSV_Datasethierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@


def main():
DATA_ROOT_PATH = r''
inputDirectory = DATA_ROOT_PATH + r''
outputFile = DATA_ROOT_PATH + r'/FileList.csv'
DATA_ROOT_PATH = r'R:\TEMP'
inputDirectory = DATA_ROOT_PATH + r'\TEST'
outputFile = DATA_ROOT_PATH + r'/FileListNEW.csv'
filetype = '.nrrd'

keywordSettings = {}
Expand All @@ -28,6 +28,7 @@ def main():
try:
with open(outputFile, 'wb') as outFile:
cw = csv.writer(outFile, lineterminator='\n')
cw.writerow(['Patient', 'StudyDate', 'Image', 'Mask'])

for patientIndex, patientDirectory in enumerate(datasetHierarchyDict):
patientID = os.path.basename(patientDirectory)
Expand All @@ -43,7 +44,7 @@ def main():

if (imageFilepath is not None) and (maskFilepath is not None):
# ReaderName is not extracted using DatasetHierarchyReader, set it to 'N/A'
cw.writerow([patientID, studyDate, 'N/A', imageFilepath, maskFilepath])
cw.writerow([patientID, studyDate, imageFilepath, maskFilepath])

except Exception as exc:
print(exc)
Expand Down
1 change: 1 addition & 0 deletions bin/batchExamples/GenerateInputCSV_Filename.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def main():
try:
with open(outputFile, 'wb') as outFile:
cw = csv.writer(outFile, lineterminator='\n')
cw.writerow(['Patient', 'Sequence', 'Reader', 'Image', 'Mask'])

for patient, Studies in sorted(six.iteritems(datasetHierarchyDict), key=lambda t: t[0]):
for Study, im_fileList in sorted(six.iteritems(Studies['reconstructions']), key=lambda t: t[0]):
Expand Down