Skip to content

Commit 8f30b46

Browse files
committed
Do not change extension when writing 8-bit images
1 parent e1bb764 commit 8f30b46

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

arachnid/pyspider/defocus.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ def create_powerspectra(filename, spi, use_powerspec=False, use_8bit=None, pad=2
333333
assert(output_pow != "" and output_pow is not None)
334334
# small image format
335335
if use_8bit:
336-
save_8bit(output_pow, mpowerspec, extra['apix'])
336+
#os.unlink(spi.replace_ext(output_pow))
337+
save_8bit(spi.replace_ext(output_pow), mpowerspec, extra['apix'])
337338
else:
338339
ndimage_file.write_image(spi.replace_ext(output_pow), mpowerspec, header=dict(apix=extra['apix']))
339340
else:
@@ -349,7 +350,8 @@ def save_8bit(output, img, apix):
349350
img = ndimage_utility.histeq(ndimage_utility.replace_outlier(img, 2.5))
350351
img = ndimage_utility.normalize_min_max(img)*255
351352
img = img.astype(numpy.uint8)
352-
ndimage_file.write_image(os.path.splitext(output)[0]+".mrc", img, header=dict(apix=apix))
353+
ndimage_file.write_image(output, img, header=dict(apix=apix))
354+
#ndimage_file.write_image(os.path.splitext(output)[0]+".mrc", img, header=dict(apix=apix))
353355

354356
def prepare_micrograph(mic, bin_factor, invert):
355357
''' Preprocess the micrograph

0 commit comments

Comments
 (0)