def copy_over_jp2_files(stack, raw_jp2_input_fn_fp, raw_jp2_input_fp): # Use name of jp2 image to find how the resolution is encoded if 'raw' in raw_jp2_input_fn_fp: resolution = '_raw' elif 'lossless' in raw_jp2_input_fn_fp: resolution = '_lossless' else: resolution = '' # CONVERT *.jp2 to *.tif json_fn = stack + '_raw_input_spec.json' # Create the data file necessary to run the jp2_to_tiff script json_data = [{ "version": None, "resolution": "raw", "data_dirs": raw_jp2_input_fp, "filepath_to_imageName_mapping": raw_jp2_input_fp + "/(.*?)" + resolution + ".jp2", "imageName_to_filepath_mapping": raw_jp2_input_fp + "/%s" + resolution + ".jp2" }] with open(json_fn, 'w') as outfile: json.dump(json_data, outfile) command = ["python", "jp2_to_tiff.py", stack, json_fn] completion_message = 'Completed converting and copying jp2 to tiff for all files in folder.' call_and_time(command, completion_message=completion_message)
def update_prep1_images(self): version = stain_to_metainfo[self.stain]['img_version_1'] create_input_spec_ini_all(name='input_spec.ini', \ stack=stack, prep_id='None', version=version, resol='thumbnail') # Call "compose" to regenerate the csv file command = [ 'python', 'compose_v3.py', 'input_spec.ini', '--op', 'from_none_to_aligned' ] completion_message = 'Finished creating transforms to anchor csv file.' call_and_time(command, completion_message=completion_message) # Apply transformations from csv and save as prep1 images command = [ 'python', 'warp_crop_v3.py', '--input_spec', 'input_spec.ini', '--op_id', 'from_none_to_padded', '--njobs', '8', '--pad_color', get_padding_color(stack) ] completion_message = 'Finished transformation to padded (prep1).' call_and_time(command, completion_message=completion_message)
) print( '_________________________________________________________________________________' ) sys.exit() if stain == 'NTB': # Extract the BLUE channel, for NTB brains create_input_spec_ini_all(name='input_spec.ini', stack=stack, prep_id='None', version='None', resol='raw') command = ["python", "extract_channel.py", "input_spec.ini", "2", "Ntb"] completion_message = 'Extracted BLUE channel.' call_and_time(command, completion_message=completion_message) # Create Thumbnails of each raw image create_input_spec_ini_all(name='input_spec.ini', stack=stack, prep_id='None', version='Ntb', resol='raw') command = [ "python", "rescale.py", "input_spec.ini", "thumbnail", "-f", "0.03125" ] completion_message = 'Generated thumbnails.' call_and_time(command, completion_message=completion_message) # Normalize intensity using thumbnails create_input_spec_ini_all(name='input_spec.ini',
def copy_over_sorted_filenames(stack, sfns_input_fp): correct_sorted_fns_fp = DataManager.get_sorted_filenames_filename(stack) command = ["cp", sfns_input_fp, correct_sorted_fns_fp] completion_message = 'Successfully copied sorted_filenames.txt over.' call_and_time(command, completion_message=completion_message)