applySuperResolutionModel: applySuperResolutionModel

View source: R/applyDBPN4x.R

applySuperResolutionModelR Documentation

applySuperResolutionModel

Description

Apply pretrained super-resolution network

Usage

applySuperResolutionModel(
  image,
  model,
  targetRange,
  batch_size = 32,
  linmatchOrder,
  mask,
  verbose = FALSE
)

Arguments

image

input image

model

model object or filename see getPretrainedNetwork

targetRange

a vector defining min max of each the input image, eg -127.5, 127.5. Output images will be scaled back to original intensity. This range should match the mapping used in the training of the network.

batch_size

for prediction call

linmatchOrder

if not missing, then apply linMatchIntensity with given fit parameter

mask

restrict intensity rescaling parameters within the mask

verbose

If TRUE, show status messages

Details

Apply a patch-wise trained network to perform super-resolution. Can be applied to variable sized inputs. Warning: This function may be better used on CPU unless the GPU can accommodate the full image size. Warning 2: The global intensity range (min to max) of the output will match the input where the range is taken over all channels.

Value

image upscaled to resolution provided by network

Author(s)

Avants BB

Examples

## Not run: 
library(ANTsRCore)
library(keras)
orig_img = antsImageRead( getANTsRData( "r16" ) )
# input needs to be 48x48
img = resampleImage(orig_img, resampleParams = rep(256/48, 2))
model = getPretrainedNetwork( "dbpn4x" )
simg <- applySuperResolutionModel(img,  model = model)
plot(orig_img)
plot(img)
plot(simg)

## End(Not run)

ANTsX/ANTsRNet documentation built on Sept. 16, 2024, 1:24 a.m.