applySuperResolutionModelPatch | R Documentation |
Apply pretrained super-resolution network by stitching together patches.
applySuperResolutionModelPatch(
image,
model,
targetRange,
lowResolutionPatchSize = 128,
strideLength = 16,
batch_size = 32,
mask,
verbose = FALSE
)
image |
input image |
model |
model object or filename see |
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. |
lowResolutionPatchSize |
size of patches to upsample |
strideLength |
voxel/pixel steps between patches |
batch_size |
for prediction call |
mask |
restrict intensity rescaling parameters within the mask |
verbose |
If |
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 patch 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.
image upscaled to resolution provided by network
Avants BB
## Not run:
library(ANTsRCore)
library( keras )
orig_img = antsImageRead( getANTsRData( "r16" ) )
# input needs to be 48x48
model = createDeepBackProjectionNetworkModel2D( list(NULL,NULL, 1) )
img = resampleImage(orig_img, resampleParams = rep(256/48, 2))
simg <- applySuperResolutionModelPatch( img,
model = model, lowResolutionPatchSize = 8, strideLength = 2)
simgm <- applySuperResolutionModelPatch( img, mask = getMask( img ),
model = model, lowResolutionPatchSize = 8, strideLength = 2)
plot( orig_img )
plot( img )
plot( simg )
plot( simgm )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.