Skip to content

Commit 0288986

Browse files
committed
Merge branch 'master' of github.com:LabNeuroCogDevel/slice_warp_gui
2 parents de7fe3c + 3ade3de commit 0288986

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

gui.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ def __init__(self, master, template, atlas):
183183
sharego = tkinter.Button(bframe, text='7. watermark', command=self.brainimgageshare)
184184
ToolTip(sharego, "launch watermarking program: brain image share")
185185

186-
186+
make_copy_old_go = tkinter.Button(bframe, text='(alt) make+copy old', command=self.make_copy_old)
187+
ToolTip(make_copy_old_go, "make old dicom dir and copy back")
188+
187189
# --- checkbox
188190
# resample to 2mm
189191
self.shouldresample = tkinter.IntVar()
@@ -221,6 +223,7 @@ def __init__(self, master, template, atlas):
221223
makego.pack(side="top", fill="both")
222224
copygo.pack(side="top", fill="both")
223225
sharego.pack(side="top", fill="both")
226+
make_copy_old_go.pack(side="top", fill="both")
224227

225228

226229
resample_check.pack(side="bottom")
@@ -480,7 +483,8 @@ def saveandafni(self):
480483
self.launch_browser()
481484

482485
# dcm rewrite done last so we can see errors in log window
483-
self.write_back_to_dicom_ml()
486+
self.alternate_dcms()
487+
#self.write_back_to_dicom_ml()
484488

485489

486490
def alternate_dcms(self, niifile='anatAndSlice_unres_slicefirst.nii.gz'):
@@ -489,7 +493,7 @@ def alternate_dcms(self, niifile='anatAndSlice_unres_slicefirst.nii.gz'):
489493
self.logfield.logtxt("Ut Oh!? DNE: " + niifile, 'error')
490494
return
491495

492-
now = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
496+
now = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
493497
self.write_back_to_dicom_ml(niifile, now + '_mlSliceFirst_')
494498
self.write_back_to_dicom_py(niifile, now + '_pySliceFirst_')
495499

@@ -612,8 +616,12 @@ def brainimgageshare(self):
612616
# os.spawnl(os.P_NOWAIT, *cmd)
613617
subprocess.Popen(cmd)
614618

619+
def make_copy_old(self):
620+
# before 2021-04-19
621+
self.write_back_to_dicom_ml()
622+
self.copyback("_mlBrainStrip_")
615623

616-
def copyback(self):
624+
def copyback(self, prefix="_mlSliceFirst_"):
617625
"""copy newly created dicom folder back to original dicom folder location
618626
"""
619627
# we'll create a new directory at the same level
@@ -623,8 +631,11 @@ def copyback(self):
623631
# YYYYMMDD_mlBrainStrip_SeriesDescrp is the default name from rewritedcm.m
624632
# we may want to change this to the python output at some time
625633
# (like when ML lisc expires)
634+
#prefix="_mlSliceFirst_" # default on 2021-04-19
635+
# _mlBrainStrip_ # before 2021-04-19
636+
# TODO: copy all?
626637
mldirpatt = datetime.datetime.now().\
627-
strftime('%Y%m%d_*_mlBrainStrip_*/')
638+
strftime(f'%Y%m%d_*{prefix}*/')
628639
# actual name is with hhmmss -- but that was some time ago
629640
# strftime('%Y%m%d_%H%M%S_mlBrainStrip_*/')
630641

rewritedcm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
read in dicoms from a given directory
1414
rewrite over data with that from given nifti
1515
save new dicoms out in protoprefix+SeriesDescription directory
16+
17+
20210419 -- imports but cannot be found!
1618
"""
1719

1820

0 commit comments

Comments
 (0)