public void Render(
Control control
)
control
Rendering surface, or the place where the objects are going to be displayed.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.MedicalViewer;
using Leadtools.Medical3D;
public void Medical3DControlExample()
{
Medical3DLoadDICOMSeriesExamples LoadObject = new Medical3DLoadDICOMSeriesExamples();
MedicalViewerSeriesManager output = LoadObject.LoadJamesHead();
MainForm1 form = new MainForm1(output);
form.ShowDialog();
}
// MainForm1 will be the owner of the medical viewer control.
class MainForm1 : Form
{
private Medical3DContainer container;
public MainForm1(MedicalViewerSeriesManager output)
{
RasterCodecs _codecs = new RasterCodecs();
RasterImage _image;
CodecsImageInfo codecsInformation;
this.FormClosing += new FormClosingEventHandler(MainForm1_FormClosing);
container = new Medical3DContainer();
container.Objects.Add(new Medical3DObject());
int index;
codecsInformation = _codecs.GetInformation((string)output.Stacks[0].Items[0].Data, true);
int width = codecsInformation.Width;
int height = codecsInformation.Height;
int depth = 256;
container.Objects[0].MemoryEfficientInit(depth);
for (index = 0; index < depth; index++)
{
_image = _codecs.Load((string)output.Stacks[0].Items[index].Data, 0, CodecsLoadByteOrder.BgrOrGrayOrRomm, 1, 1);
container.Objects[0].MemoryEfficientSetFrame(_image, index, output.Stacks[0].Items[index].ImagePosition, true);
}
string spearator = ("\\");
string[] test = output.Stacks[0].Items[0].ImageOrientation.Split(spearator.ToCharArray());
float[] orientation = new float[6];
int i;
for (i = 0; i < 6; i++)
{
orientation[i] = (float)Convert.ToDouble(test[i]);
}
container.Objects[0].MemoryEfficientEnd(orientation, output.Stacks[0].PixelSpacing);
this.MouseDown += new MouseEventHandler(_control_MouseDown);
this.MouseMove += new MouseEventHandler(_control_MouseMove);
this.MouseUp += new MouseEventHandler(_control_MouseUp);
}
protected override void OnSizeChanged(EventArgs e)
{
container.Render(this);
}
protected override void OnPaint(PaintEventArgs e)
{
container.Render(this);
}
void MainForm1_FormClosing(object sender, FormClosingEventArgs e)
{
container.Dispose();
}
void _control_MouseUp(object sender, MouseEventArgs e)
{
container.HandleMouseUp(this, e, 0);
}
void _control_MouseMove(object sender, MouseEventArgs e)
{
container.HandleMouseMove(this, e, 0);
}
void _control_MouseDown(object sender, MouseEventArgs e)
{
container.HandleMouseDown(MedicalViewerActionType.Rotate3DObject, this, e, 0);
}
}