private void initializeFromStackFrame(StackFrame stack) {

		returnAddressOffset = stack.getReturnAddressOffset();
		growsNegative = stack.growsNegative();
		function = stack.getFunction();
		parameterOffset = stack.getParameterOffset();

		int paramSize = stack.getParameterSize();
		int localSize = stack.getLocalSize();
		if (growsNegative) {
			// locals come first
			negativeLength = localSize;
			positiveLength = paramSize;
		}
		else {
			// params come first
			negativeLength = paramSize;
			positiveLength = localSize;
		}

		wrappedStruct = new StructureDataType(STACK_STRUCTURE_NAME, stack.getFrameSize(), dtm);

		Variable[] stackVars = stack.getStackVariables();
		for (int i = stackVars.length - 1; i >= 0; i--) {
			Variable var = stackVars[i];
			VariableStorage storage = var.getVariableStorage();
			Varnode stackVarnode = storage.getLastVarnode();
			int length = stackVarnode.getSize();
			int offset = (int) stackVarnode.getOffset();

			// TODO: Investigate is joined-stack variables are reflected in Function stack related methods
			// TODO: Why are the following checks needed?
			if (offset < (parameterOffset - negativeLength)) {
				continue;
			}
			if ((offset + length - 1) > (positiveLength + parameterOffset)) {
				continue;
			}

			String comment = buildComment(var);

			DataType dt = var.getDataType();
			if (dt == DataType.DEFAULT) {
				// Use BadDataType as placeholder within Structure
				length = 1;
				dt = BadDataType.dataType;
			}

			doReplaceAtOffset(offset, dt, length, var.getName(), comment);
		}
	}
Constructor for an editable stack frame for use with the editor.
The specified {@link StackFrameDataType} instance will be copied into this new instance

@param stackDt stack frame editor datatype
@param dtm dtm datatype manager (required)
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackFrameDataType.java