antspymm 1.4.2__py3-none-any.whl → 1.4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
antspymm/mm.py CHANGED
@@ -2738,11 +2738,47 @@ def get_data( name=None, force_download=False, version=25, target_extension='.cs
2738
2738
  """
2739
2739
  os.makedirs(DATA_PATH, exist_ok=True)
2740
2740
 
2741
+ def mv_subfolder_files(folder, verbose=False):
2742
+ """
2743
+ Move files from subfolders to the parent folder.
2744
+
2745
+ Parameters
2746
+ ----------
2747
+ folder : str
2748
+ Path to the folder.
2749
+ verbose : bool, optional
2750
+ Print information about the files and folders being processed (default is False).
2751
+
2752
+ Returns
2753
+ -------
2754
+ None
2755
+ """
2756
+ import os
2757
+ import shutil
2758
+ for root, dirs, files in os.walk(folder):
2759
+ if verbose:
2760
+ print(f"Processing directory: {root}")
2761
+ print(f"Subdirectories: {dirs}")
2762
+ print(f"Files: {files}")
2763
+
2764
+ for file in files:
2765
+ if root != folder:
2766
+ if verbose:
2767
+ print(f"Moving file: {file} from {root} to {folder}")
2768
+ shutil.move(os.path.join(root, file), folder)
2769
+
2770
+ for dir in dirs:
2771
+ if root != folder:
2772
+ if verbose:
2773
+ print(f"Removing directory: {dir} from {root}")
2774
+ shutil.rmtree(os.path.join(root, dir))
2775
+
2741
2776
  def download_data( version ):
2742
2777
  url = "https://figshare.com/ndownloader/articles/16912366/versions/" + str(version)
2743
2778
  target_file_name = "16912366.zip"
2744
2779
  target_file_name_path = tf.keras.utils.get_file(target_file_name, url,
2745
2780
  cache_subdir=DATA_PATH, extract = True )
2781
+ mv_subfolder_files( os.path.expanduser("~/.antspymm"), False )
2746
2782
  os.remove( DATA_PATH + target_file_name )
2747
2783
 
2748
2784
  if force_download:
@@ -2762,6 +2798,7 @@ def get_data( name=None, force_download=False, version=25, target_extension='.cs
2762
2798
  fname = os.path.join(DATA_PATH, fname)
2763
2799
  files.append(fname)
2764
2800
 
2801
+
2765
2802
  if name == 'all':
2766
2803
  return files
2767
2804
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: antspymm
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: multi-channel/time-series medical image processing with antspyx
5
5
  Author-email: "Avants, Gosselin, Tustison, Reardon" <stnava@gmail.com>
6
6
  License: Apache 2.0
@@ -0,0 +1,7 @@
1
+ antspymm/__init__.py,sha256=qUzRd3GmYB8hSO7GNaBuP7Jlm0QNMttTaUfvIpeeAig,4497
2
+ antspymm/mm.py,sha256=2X6zZaERE8tPbzkcyNGD8vIZcpA1T3ej24_jGOnESRA,504283
3
+ antspymm-1.4.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
+ antspymm-1.4.3.dist-info/METADATA,sha256=YSSsqoF26p_IVPzEtiShVaNwBc5Bue3FPfZY6iVaCnY,25668
5
+ antspymm-1.4.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
6
+ antspymm-1.4.3.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
7
+ antspymm-1.4.3.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- antspymm/__init__.py,sha256=qUzRd3GmYB8hSO7GNaBuP7Jlm0QNMttTaUfvIpeeAig,4497
2
- antspymm/mm.py,sha256=iZvIpNvltqqzmtEF1D9tDoMUIbJK-GpsOjzSaH3z1ns,503059
3
- antspymm-1.4.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
- antspymm-1.4.2.dist-info/METADATA,sha256=6Z-7BaP2_duk8af-kmSXg99BZcCzbWm7yhsxvxi7JRk,25668
5
- antspymm-1.4.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
6
- antspymm-1.4.2.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
7
- antspymm-1.4.2.dist-info/RECORD,,