niwrap.ants.non_local_super_resolution
1# This file was auto generated by Styx. 2# Do not edit this file directly. 3 4import typing 5import pathlib 6from styxdefs import * 7 8NON_LOCAL_SUPER_RESOLUTION_METADATA = Metadata( 9 id="51aada9b4dbce0b9d25369841901cb709639d1e3.boutiques", 10 name="NonLocalSuperResolution", 11 package="ants", 12 container_image_tag="antsx/ants:v2.5.3", 13) 14 15 16NonLocalSuperResolutionParameters = typing.TypedDict('NonLocalSuperResolutionParameters', { 17 "__STYX_TYPE__": typing.Literal["NonLocalSuperResolution"], 18 "image_dimensionality": typing.NotRequired[typing.Literal[2, 3, 4] | None], 19 "input_image": InputPathType, 20 "interpolated_image": typing.NotRequired[InputPathType | None], 21 "reference_image": typing.NotRequired[InputPathType | None], 22 "patch_radius": typing.NotRequired[typing.Literal["1", "1x1x1"] | None], 23 "search_radius": typing.NotRequired[typing.Literal["3", "3x3x3"] | None], 24 "intensity_difference_sigma": typing.NotRequired[float | None], 25 "patch_similarity_sigma": typing.NotRequired[float | None], 26 "scale_levels": typing.NotRequired[str | None], 27 "interpolation": typing.NotRequired[typing.Literal["Linear", "NearestNeighbor", "Gaussian", "BSpline", "CosineWindowedSinc", "WelchWindowedSinc", "HammingWindowedSinc", "LanczosWindowedSinc"] | None], 28 "output": str, 29 "verbose": typing.NotRequired[typing.Literal[0, 1] | None], 30}) 31 32 33def dyn_cargs( 34 t: str, 35) -> typing.Any: 36 """ 37 Get build cargs function by command type. 38 39 Args: 40 t: Command type. 41 Returns: 42 Build cargs function. 43 """ 44 return { 45 "NonLocalSuperResolution": non_local_super_resolution_cargs, 46 }.get(t) 47 48 49def dyn_outputs( 50 t: str, 51) -> typing.Any: 52 """ 53 Get build outputs function by command type. 54 55 Args: 56 t: Command type. 57 Returns: 58 Build outputs function. 59 """ 60 return { 61 "NonLocalSuperResolution": non_local_super_resolution_outputs, 62 }.get(t) 63 64 65class NonLocalSuperResolutionOutputs(typing.NamedTuple): 66 """ 67 Output object returned when calling `non_local_super_resolution(...)`. 68 """ 69 root: OutputPathType 70 """Output root folder. This is the root folder for all outputs.""" 71 superresoluted_output: OutputPathType 72 """The superresoluted output image.""" 73 74 75def non_local_super_resolution_params( 76 input_image: InputPathType, 77 output: str, 78 image_dimensionality: typing.Literal[2, 3, 4] | None = None, 79 interpolated_image: InputPathType | None = None, 80 reference_image: InputPathType | None = None, 81 patch_radius: typing.Literal["1", "1x1x1"] | None = None, 82 search_radius: typing.Literal["3", "3x3x3"] | None = None, 83 intensity_difference_sigma: float | None = 1.0, 84 patch_similarity_sigma: float | None = 1.0, 85 scale_levels: str | None = "32x16x8x2x1", 86 interpolation: typing.Literal["Linear", "NearestNeighbor", "Gaussian", "BSpline", "CosineWindowedSinc", "WelchWindowedSinc", "HammingWindowedSinc", "LanczosWindowedSinc"] | None = None, 87 verbose: typing.Literal[0, 1] | None = None, 88) -> NonLocalSuperResolutionParameters: 89 """ 90 Build parameters. 91 92 Args: 93 input_image: A low-resolution input image to be superresoluted. 94 output: The output consists of the noise corrected version of the input\ 95 image. Optionally, one can also output the estimated noise image. 96 image_dimensionality: This option forces the image to be treated as a\ 97 specified-dimensional image. If not specified, the program tries to\ 98 infer the dimensionality from the input image. 99 interpolated_image: An interpolated version of the low-resolution image\ 100 (such as B-spline). Specify either this option or a high-resolution\ 101 multi-modal counterpart (cf the -k option). 102 reference_image: A high-resolution reference multi-modal image. Assumed\ 103 to be in the same space as the low-resolution input image. Specify\ 104 either this option or an interpolated version (cf the -j option). 105 patch_radius: Patch radius. Default = 1x1x1. 106 search_radius: Search radius. Default = 3x3x3. 107 intensity_difference_sigma: Intensity difference sigma. Default = 1.0. 108 patch_similarity_sigma: Patch similarity sigma. Default = 1.0. 109 scale_levels: Scale levels. Default = 32x16x8x2x1. 110 interpolation: Several interpolation options are available in ITK. 111 verbose: Verbose output. 112 Returns: 113 Parameter dictionary 114 """ 115 params = { 116 "__STYXTYPE__": "NonLocalSuperResolution", 117 "input_image": input_image, 118 "output": output, 119 } 120 if image_dimensionality is not None: 121 params["image_dimensionality"] = image_dimensionality 122 if interpolated_image is not None: 123 params["interpolated_image"] = interpolated_image 124 if reference_image is not None: 125 params["reference_image"] = reference_image 126 if patch_radius is not None: 127 params["patch_radius"] = patch_radius 128 if search_radius is not None: 129 params["search_radius"] = search_radius 130 if intensity_difference_sigma is not None: 131 params["intensity_difference_sigma"] = intensity_difference_sigma 132 if patch_similarity_sigma is not None: 133 params["patch_similarity_sigma"] = patch_similarity_sigma 134 if scale_levels is not None: 135 params["scale_levels"] = scale_levels 136 if interpolation is not None: 137 params["interpolation"] = interpolation 138 if verbose is not None: 139 params["verbose"] = verbose 140 return params 141 142 143def non_local_super_resolution_cargs( 144 params: NonLocalSuperResolutionParameters, 145 execution: Execution, 146) -> list[str]: 147 """ 148 Build command-line arguments from parameters. 149 150 Args: 151 params: The parameters. 152 execution: The execution object for resolving input paths. 153 Returns: 154 Command-line arguments. 155 """ 156 cargs = [] 157 cargs.append("NonLocalSuperResolution") 158 if params.get("image_dimensionality") is not None: 159 cargs.extend([ 160 "-d", 161 str(params.get("image_dimensionality")) 162 ]) 163 cargs.extend([ 164 "-i", 165 execution.input_file(params.get("input_image")) 166 ]) 167 if params.get("interpolated_image") is not None: 168 cargs.extend([ 169 "-j", 170 execution.input_file(params.get("interpolated_image")) 171 ]) 172 if params.get("reference_image") is not None: 173 cargs.extend([ 174 "-k", 175 execution.input_file(params.get("reference_image")) 176 ]) 177 if params.get("patch_radius") is not None: 178 cargs.extend([ 179 "-p", 180 params.get("patch_radius") 181 ]) 182 if params.get("search_radius") is not None: 183 cargs.extend([ 184 "-r", 185 params.get("search_radius") 186 ]) 187 if params.get("intensity_difference_sigma") is not None: 188 cargs.extend([ 189 "-g", 190 str(params.get("intensity_difference_sigma")) 191 ]) 192 if params.get("patch_similarity_sigma") is not None: 193 cargs.extend([ 194 "-t", 195 str(params.get("patch_similarity_sigma")) 196 ]) 197 if params.get("scale_levels") is not None: 198 cargs.extend([ 199 "-s", 200 params.get("scale_levels") 201 ]) 202 if params.get("interpolation") is not None: 203 cargs.extend([ 204 "-n", 205 params.get("interpolation") 206 ]) 207 cargs.extend([ 208 "-o", 209 params.get("output") 210 ]) 211 if params.get("verbose") is not None: 212 cargs.extend([ 213 "-v", 214 str(params.get("verbose")) 215 ]) 216 return cargs 217 218 219def non_local_super_resolution_outputs( 220 params: NonLocalSuperResolutionParameters, 221 execution: Execution, 222) -> NonLocalSuperResolutionOutputs: 223 """ 224 Build outputs object containing output file paths and possibly stdout/stderr. 225 226 Args: 227 params: The parameters. 228 execution: The execution object for resolving input paths. 229 Returns: 230 Outputs object. 231 """ 232 ret = NonLocalSuperResolutionOutputs( 233 root=execution.output_file("."), 234 superresoluted_output=execution.output_file(params.get("output")), 235 ) 236 return ret 237 238 239def non_local_super_resolution_execute( 240 params: NonLocalSuperResolutionParameters, 241 execution: Execution, 242) -> NonLocalSuperResolutionOutputs: 243 """ 244 Non-local super resolution described in the papers by JV Manjon et al., focusing 245 on MRI superresolution using self-similarity and image priors. 246 247 Author: ANTs Developers 248 249 URL: https://github.com/ANTsX/ANTs 250 251 Args: 252 params: The parameters. 253 execution: The execution object. 254 Returns: 255 NamedTuple of outputs (described in `NonLocalSuperResolutionOutputs`). 256 """ 257 params = execution.params(params) 258 cargs = non_local_super_resolution_cargs(params, execution) 259 ret = non_local_super_resolution_outputs(params, execution) 260 execution.run(cargs) 261 return ret 262 263 264def non_local_super_resolution( 265 input_image: InputPathType, 266 output: str, 267 image_dimensionality: typing.Literal[2, 3, 4] | None = None, 268 interpolated_image: InputPathType | None = None, 269 reference_image: InputPathType | None = None, 270 patch_radius: typing.Literal["1", "1x1x1"] | None = None, 271 search_radius: typing.Literal["3", "3x3x3"] | None = None, 272 intensity_difference_sigma: float | None = 1.0, 273 patch_similarity_sigma: float | None = 1.0, 274 scale_levels: str | None = "32x16x8x2x1", 275 interpolation: typing.Literal["Linear", "NearestNeighbor", "Gaussian", "BSpline", "CosineWindowedSinc", "WelchWindowedSinc", "HammingWindowedSinc", "LanczosWindowedSinc"] | None = None, 276 verbose: typing.Literal[0, 1] | None = None, 277 runner: Runner | None = None, 278) -> NonLocalSuperResolutionOutputs: 279 """ 280 Non-local super resolution described in the papers by JV Manjon et al., focusing 281 on MRI superresolution using self-similarity and image priors. 282 283 Author: ANTs Developers 284 285 URL: https://github.com/ANTsX/ANTs 286 287 Args: 288 input_image: A low-resolution input image to be superresoluted. 289 output: The output consists of the noise corrected version of the input\ 290 image. Optionally, one can also output the estimated noise image. 291 image_dimensionality: This option forces the image to be treated as a\ 292 specified-dimensional image. If not specified, the program tries to\ 293 infer the dimensionality from the input image. 294 interpolated_image: An interpolated version of the low-resolution image\ 295 (such as B-spline). Specify either this option or a high-resolution\ 296 multi-modal counterpart (cf the -k option). 297 reference_image: A high-resolution reference multi-modal image. Assumed\ 298 to be in the same space as the low-resolution input image. Specify\ 299 either this option or an interpolated version (cf the -j option). 300 patch_radius: Patch radius. Default = 1x1x1. 301 search_radius: Search radius. Default = 3x3x3. 302 intensity_difference_sigma: Intensity difference sigma. Default = 1.0. 303 patch_similarity_sigma: Patch similarity sigma. Default = 1.0. 304 scale_levels: Scale levels. Default = 32x16x8x2x1. 305 interpolation: Several interpolation options are available in ITK. 306 verbose: Verbose output. 307 runner: Command runner. 308 Returns: 309 NamedTuple of outputs (described in `NonLocalSuperResolutionOutputs`). 310 """ 311 runner = runner or get_global_runner() 312 execution = runner.start_execution(NON_LOCAL_SUPER_RESOLUTION_METADATA) 313 params = non_local_super_resolution_params( 314 image_dimensionality=image_dimensionality, 315 input_image=input_image, 316 interpolated_image=interpolated_image, 317 reference_image=reference_image, 318 patch_radius=patch_radius, 319 search_radius=search_radius, 320 intensity_difference_sigma=intensity_difference_sigma, 321 patch_similarity_sigma=patch_similarity_sigma, 322 scale_levels=scale_levels, 323 interpolation=interpolation, 324 output=output, 325 verbose=verbose, 326 ) 327 return non_local_super_resolution_execute(params, execution) 328 329 330__all__ = [ 331 "NON_LOCAL_SUPER_RESOLUTION_METADATA", 332 "NonLocalSuperResolutionOutputs", 333 "NonLocalSuperResolutionParameters", 334 "non_local_super_resolution", 335 "non_local_super_resolution_params", 336]
NON_LOCAL_SUPER_RESOLUTION_METADATA =
Metadata(id='51aada9b4dbce0b9d25369841901cb709639d1e3.boutiques', name='NonLocalSuperResolution', package='ants', citations=None, container_image_tag='antsx/ants:v2.5.3')
class
NonLocalSuperResolutionOutputs(typing.NamedTuple):
66class NonLocalSuperResolutionOutputs(typing.NamedTuple): 67 """ 68 Output object returned when calling `non_local_super_resolution(...)`. 69 """ 70 root: OutputPathType 71 """Output root folder. This is the root folder for all outputs.""" 72 superresoluted_output: OutputPathType 73 """The superresoluted output image."""
Output object returned when calling non_local_super_resolution(...)
.
class
NonLocalSuperResolutionParameters(typing.TypedDict):
def
non_local_super_resolution( input_image: pathlib._local.Path | str, output: str, image_dimensionality: Optional[Literal[2, 3, 4]] = None, interpolated_image: pathlib._local.Path | str | None = None, reference_image: pathlib._local.Path | str | None = None, patch_radius: Optional[Literal['1', '1x1x1']] = None, search_radius: Optional[Literal['3', '3x3x3']] = None, intensity_difference_sigma: float | None = 1.0, patch_similarity_sigma: float | None = 1.0, scale_levels: str | None = '32x16x8x2x1', interpolation: Optional[Literal['Linear', 'NearestNeighbor', 'Gaussian', 'BSpline', 'CosineWindowedSinc', 'WelchWindowedSinc', 'HammingWindowedSinc', 'LanczosWindowedSinc']] = None, verbose: Optional[Literal[0, 1]] = None, runner: styxdefs.types.Runner | None = None) -> NonLocalSuperResolutionOutputs:
265def non_local_super_resolution( 266 input_image: InputPathType, 267 output: str, 268 image_dimensionality: typing.Literal[2, 3, 4] | None = None, 269 interpolated_image: InputPathType | None = None, 270 reference_image: InputPathType | None = None, 271 patch_radius: typing.Literal["1", "1x1x1"] | None = None, 272 search_radius: typing.Literal["3", "3x3x3"] | None = None, 273 intensity_difference_sigma: float | None = 1.0, 274 patch_similarity_sigma: float | None = 1.0, 275 scale_levels: str | None = "32x16x8x2x1", 276 interpolation: typing.Literal["Linear", "NearestNeighbor", "Gaussian", "BSpline", "CosineWindowedSinc", "WelchWindowedSinc", "HammingWindowedSinc", "LanczosWindowedSinc"] | None = None, 277 verbose: typing.Literal[0, 1] | None = None, 278 runner: Runner | None = None, 279) -> NonLocalSuperResolutionOutputs: 280 """ 281 Non-local super resolution described in the papers by JV Manjon et al., focusing 282 on MRI superresolution using self-similarity and image priors. 283 284 Author: ANTs Developers 285 286 URL: https://github.com/ANTsX/ANTs 287 288 Args: 289 input_image: A low-resolution input image to be superresoluted. 290 output: The output consists of the noise corrected version of the input\ 291 image. Optionally, one can also output the estimated noise image. 292 image_dimensionality: This option forces the image to be treated as a\ 293 specified-dimensional image. If not specified, the program tries to\ 294 infer the dimensionality from the input image. 295 interpolated_image: An interpolated version of the low-resolution image\ 296 (such as B-spline). Specify either this option or a high-resolution\ 297 multi-modal counterpart (cf the -k option). 298 reference_image: A high-resolution reference multi-modal image. Assumed\ 299 to be in the same space as the low-resolution input image. Specify\ 300 either this option or an interpolated version (cf the -j option). 301 patch_radius: Patch radius. Default = 1x1x1. 302 search_radius: Search radius. Default = 3x3x3. 303 intensity_difference_sigma: Intensity difference sigma. Default = 1.0. 304 patch_similarity_sigma: Patch similarity sigma. Default = 1.0. 305 scale_levels: Scale levels. Default = 32x16x8x2x1. 306 interpolation: Several interpolation options are available in ITK. 307 verbose: Verbose output. 308 runner: Command runner. 309 Returns: 310 NamedTuple of outputs (described in `NonLocalSuperResolutionOutputs`). 311 """ 312 runner = runner or get_global_runner() 313 execution = runner.start_execution(NON_LOCAL_SUPER_RESOLUTION_METADATA) 314 params = non_local_super_resolution_params( 315 image_dimensionality=image_dimensionality, 316 input_image=input_image, 317 interpolated_image=interpolated_image, 318 reference_image=reference_image, 319 patch_radius=patch_radius, 320 search_radius=search_radius, 321 intensity_difference_sigma=intensity_difference_sigma, 322 patch_similarity_sigma=patch_similarity_sigma, 323 scale_levels=scale_levels, 324 interpolation=interpolation, 325 output=output, 326 verbose=verbose, 327 ) 328 return non_local_super_resolution_execute(params, execution)
Non-local super resolution described in the papers by JV Manjon et al., focusing on MRI superresolution using self-similarity and image priors.
Author: ANTs Developers
URL: https://github.com/ANTsX/ANTs
Arguments:
- input_image: A low-resolution input image to be superresoluted.
- output: The output consists of the noise corrected version of the input image. Optionally, one can also output the estimated noise image.
- image_dimensionality: This option forces the image to be treated as a specified-dimensional image. If not specified, the program tries to infer the dimensionality from the input image.
- interpolated_image: An interpolated version of the low-resolution image (such as B-spline). Specify either this option or a high-resolution multi-modal counterpart (cf the -k option).
- reference_image: A high-resolution reference multi-modal image. Assumed to be in the same space as the low-resolution input image. Specify either this option or an interpolated version (cf the -j option).
- patch_radius: Patch radius. Default = 1x1x1.
- search_radius: Search radius. Default = 3x3x3.
- intensity_difference_sigma: Intensity difference sigma. Default = 1.0.
- patch_similarity_sigma: Patch similarity sigma. Default = 1.0.
- scale_levels: Scale levels. Default = 32x16x8x2x1.
- interpolation: Several interpolation options are available in ITK.
- verbose: Verbose output.
- runner: Command runner.
Returns:
NamedTuple of outputs (described in
NonLocalSuperResolutionOutputs
).
def
non_local_super_resolution_params( input_image: pathlib._local.Path | str, output: str, image_dimensionality: Optional[Literal[2, 3, 4]] = None, interpolated_image: pathlib._local.Path | str | None = None, reference_image: pathlib._local.Path | str | None = None, patch_radius: Optional[Literal['1', '1x1x1']] = None, search_radius: Optional[Literal['3', '3x3x3']] = None, intensity_difference_sigma: float | None = 1.0, patch_similarity_sigma: float | None = 1.0, scale_levels: str | None = '32x16x8x2x1', interpolation: Optional[Literal['Linear', 'NearestNeighbor', 'Gaussian', 'BSpline', 'CosineWindowedSinc', 'WelchWindowedSinc', 'HammingWindowedSinc', 'LanczosWindowedSinc']] = None, verbose: Optional[Literal[0, 1]] = None) -> NonLocalSuperResolutionParameters:
76def non_local_super_resolution_params( 77 input_image: InputPathType, 78 output: str, 79 image_dimensionality: typing.Literal[2, 3, 4] | None = None, 80 interpolated_image: InputPathType | None = None, 81 reference_image: InputPathType | None = None, 82 patch_radius: typing.Literal["1", "1x1x1"] | None = None, 83 search_radius: typing.Literal["3", "3x3x3"] | None = None, 84 intensity_difference_sigma: float | None = 1.0, 85 patch_similarity_sigma: float | None = 1.0, 86 scale_levels: str | None = "32x16x8x2x1", 87 interpolation: typing.Literal["Linear", "NearestNeighbor", "Gaussian", "BSpline", "CosineWindowedSinc", "WelchWindowedSinc", "HammingWindowedSinc", "LanczosWindowedSinc"] | None = None, 88 verbose: typing.Literal[0, 1] | None = None, 89) -> NonLocalSuperResolutionParameters: 90 """ 91 Build parameters. 92 93 Args: 94 input_image: A low-resolution input image to be superresoluted. 95 output: The output consists of the noise corrected version of the input\ 96 image. Optionally, one can also output the estimated noise image. 97 image_dimensionality: This option forces the image to be treated as a\ 98 specified-dimensional image. If not specified, the program tries to\ 99 infer the dimensionality from the input image. 100 interpolated_image: An interpolated version of the low-resolution image\ 101 (such as B-spline). Specify either this option or a high-resolution\ 102 multi-modal counterpart (cf the -k option). 103 reference_image: A high-resolution reference multi-modal image. Assumed\ 104 to be in the same space as the low-resolution input image. Specify\ 105 either this option or an interpolated version (cf the -j option). 106 patch_radius: Patch radius. Default = 1x1x1. 107 search_radius: Search radius. Default = 3x3x3. 108 intensity_difference_sigma: Intensity difference sigma. Default = 1.0. 109 patch_similarity_sigma: Patch similarity sigma. Default = 1.0. 110 scale_levels: Scale levels. Default = 32x16x8x2x1. 111 interpolation: Several interpolation options are available in ITK. 112 verbose: Verbose output. 113 Returns: 114 Parameter dictionary 115 """ 116 params = { 117 "__STYXTYPE__": "NonLocalSuperResolution", 118 "input_image": input_image, 119 "output": output, 120 } 121 if image_dimensionality is not None: 122 params["image_dimensionality"] = image_dimensionality 123 if interpolated_image is not None: 124 params["interpolated_image"] = interpolated_image 125 if reference_image is not None: 126 params["reference_image"] = reference_image 127 if patch_radius is not None: 128 params["patch_radius"] = patch_radius 129 if search_radius is not None: 130 params["search_radius"] = search_radius 131 if intensity_difference_sigma is not None: 132 params["intensity_difference_sigma"] = intensity_difference_sigma 133 if patch_similarity_sigma is not None: 134 params["patch_similarity_sigma"] = patch_similarity_sigma 135 if scale_levels is not None: 136 params["scale_levels"] = scale_levels 137 if interpolation is not None: 138 params["interpolation"] = interpolation 139 if verbose is not None: 140 params["verbose"] = verbose 141 return params
Build parameters.
Arguments:
- input_image: A low-resolution input image to be superresoluted.
- output: The output consists of the noise corrected version of the input image. Optionally, one can also output the estimated noise image.
- image_dimensionality: This option forces the image to be treated as a specified-dimensional image. If not specified, the program tries to infer the dimensionality from the input image.
- interpolated_image: An interpolated version of the low-resolution image (such as B-spline). Specify either this option or a high-resolution multi-modal counterpart (cf the -k option).
- reference_image: A high-resolution reference multi-modal image. Assumed to be in the same space as the low-resolution input image. Specify either this option or an interpolated version (cf the -j option).
- patch_radius: Patch radius. Default = 1x1x1.
- search_radius: Search radius. Default = 3x3x3.
- intensity_difference_sigma: Intensity difference sigma. Default = 1.0.
- patch_similarity_sigma: Patch similarity sigma. Default = 1.0.
- scale_levels: Scale levels. Default = 32x16x8x2x1.
- interpolation: Several interpolation options are available in ITK.
- verbose: Verbose output.
Returns:
Parameter dictionary