# Converting from previous TLT

## Transforms

Transforms are now in the Clara Train API package. Compared to how they were before in TLT, they have been designed to be more data-driven rather than configuration driven, and now use a more standardized transform context (transform_ctx) that typically expects MedicalImages with ShapeFormat data. With ShapeFormat readily available, each transform can easily know what are the data dimensions, whether the data is channel first or channels last, and whether it is batched without having to manually configure the data format as a parameter.

Many transforms have been renamed so they are purpose instead of mechanism based in order to help the user better understand what is happening through the transform chain and why. For example, instead of VolumeTo4DArray previously, ConvertToChannelsFirst makes it clear what the purpose of the transform is (and also generalizes to work for 2D and 3D image data, all without having to specify a data format manually).

Below is a table providing a mapping of previous TLT transforms to their equivalent classes in ai4med.components.transforms.

Note

It is possible that parameters have been added, removed, renamed, or reordered in the new versions of transforms in Clara Train API.

Old

New

Notes

TransformVolumeCropROIFastPosNegRatio

FastPosNegRatioCropROI

CropSubVolumeBatchPosNegRatio without fast_crop

CropByPosNegRatio

CropSubVolumeBatchPosNegRatio with fast_crop

FastCropByPosNegRatio

image_field -> fields

CropByPosNegRatioLabelOnly

CropForegroundObject

CropForegroundObject

CropSubVolumeCenter

CropSubVolumeCenter

CropRandomSubImageInRange

CropRandomSizeWithDisplacement

image_field -> fields, no more data_format

CropSubVolumeRandomWithinBounds

CropFixedSizeRandomCenter

ResampleVolume

ScaleByFactor

ScaleByResolution

ScaleBySpacing

NPResize3D

ScaleToShape

NPResizeImage

ScaleToShape

applied_keys -> fields, output_shape -> target_shape, no more data_format

RestoreOriginalShape

NPRandomZoom3D

RandomZoom

FlipAxisRandom

RandomSpatialFlip

no more data_format, no more axis because all spatial axes are now known and used

NPRandomFlip3D

RandomAxisFlip

applied_keys -> fields

NPRandomRot90XY

RandomRotate3D

applied_keys -> fields

NP2DRotate

RandomRotate2D

applied_keys -> fields, random -> is_random, no more data_format

NormalizeNonzeroIntensities

NormalizeNonzeroIntensities

CenterData

CenterData

applied_keys -> fields

field -> fields

field -> fields

ScaleIntensityOscillation

ScaleIntensityOscillation

field -> fields

ScaleIntensityRange

ScaleIntensityRange

field -> fields

AugmentIntensityRandomScaleShift

ScaleShiftIntensity

FetchExtremePoints

BratsConvertLabels

ConvertToMultiChannelBasedOnBratsClasses

ConvertToMultiChannelBasedOnLabel

SplitAcrossChannels

SplitAcrossChannels

no more squeeze

SplitBasedOnLabel

SplitBasedOnLabel

applied_key -> field, channel_names -> label_names

ArgmaxAcrossChannels

ArgmaxAcrossChannels

applied_keys -> fields

ThresholdValues

ApplyThreshold

LabelSelection

ReplaceLabels

SplitBasedOnBratsClasses

SplitBasedOnBratsClasses

NPRepChannels

RepeatChannel

applied_keys -> fields, repeat -> repeat_times, no more channel_axis

VolumeTo4DArray (depending on usage)

ConvertToChannelsFirst

NPExpandDims (depending on usage)

ConvertToChannelsLast

LoadResolutionFromNifty is no longer needed as LoadNifti now saves the original resolution as a property of the MedicalImage.

Load3DShapeFromNumpy is no longer needed as LoadNifti now saves the original shape as a property of the MedicalImage.

## ImagePipeline

Note

task is no longer needed becauses the subclasses are task specific. Other parameters have been renamed and modified as well to be applicable to each subclass.

## New variables in config_train.json

determinism - See determinism.

use_amp - See Automatic Mixed Precision.

dynamic_input_shape - This used to be set by having crop_size be [-1, -1, -1] in the ImagePipeline, but now ImagePipeline’s subclasses should be used and they use output_crop_size to specify the crop size of the output from the image pipeline. dynamic_input_shape being set to true is now what controls whether a model is constructed with dynamic input shape (so inference can be performed on images of a different shape). See Improving inference performance for details.

## Other changes

The data conversion tool has been renamed from tlt-dataconvert to nvmidl-dataconvert.

Component

Old

New

Notes

lr_policy

DecayLRonStep

DecayOnStep

ReduceLRPoly

ReducePoly

model

SegmAhnet3D

SegAhnet

metrics

MetricAverageFromArrayDice

ComputeAverageDice

applied_key -> field, label_key -> label_field, stopping_metric -> is_key_metric

MetricAverage

ComputeAverage

applied_key -> field

MetricAUC

ComputeAUC

applied_key -> field, label_key -> label_field, stopping_metric -> is_key_metric

inferer

ScanWindowInferer

TFScanWindowInferer

no more is_channels_first

SimpleInferer

TFSimpleInferer

writer

NiftyWriter

WriteNifti

applied_key -> field

loss

ClassificationLoss

BinaryClassificationLoss

like in the classification config example, some of what used to be implemented as metrics should now be implemented as aux_ops:

• AccuracyComputer -> ComputeAccuracy: tags -> tag

• ClassificationMetric -> ComputeBinaryPreds