pacsifier.cli.create_dicomdir module
Script to create a DICOMDIR of all dicoms within a folder.
- pacsifier.cli.create_dicomdir.add_or_retrieve_name(current_folder: str, old_2_new: Dict[str, str]) Tuple[str, Dict[str, str]][source]
Check if the current folder has had a generated new name. If that is the case, return its new name, otherwise, generate a new name.
- Parameters:
current_folder – current folder to be considered
old_2_new – dictionary keeping track of mapping between old and new folder / file names
- Returns:
tuple containing the new name and the updated mapping between old and new name.
- Return type:
tuple
- pacsifier.cli.create_dicomdir.create_dicomdir(out_path: str) None[source]
Create a DICOMDIR of all dicoms with the path passed as parameter.
- Parameters:
out_path – path of dicoms
- pacsifier.cli.create_dicomdir.generate_new_folder_name(names: List[str] = []) str[source]
Generate a folder/file name having between 4 and 8 characters of capital letters and digits.
- Parameters:
names – new names already generated for other folders.
- Returns:
Generated folder/file name.
- Return type:
str
- pacsifier.cli.create_dicomdir.get_parser() ArgumentParser[source]
Get parser object for command line arguments of the script.
- pacsifier.cli.create_dicomdir.main()[source]
Main function of the script that calls
move_and_rename_files()andcreate_dicomdir().
- pacsifier.cli.create_dicomdir.move_and_rename_files(dicom_path: str, output_path: str) None[source]
Copy all the files within the dicom hierarchy into new hierarchy with appropriate names for DICOMDIR creation.
- Parameters:
dicom_path – current folder to be considered
output_path – path where the new dicom hierarchy will be stored