Hi Roman,
The LEADTOOLS
Medical Viewer has two separate options to create the grid layout controls needed to display and manage DICOM files.
The two available are ‘Grid’ and ‘Random’ which can be found in the
CellsArrangment Enumeration for you to declare.
The Grid arrangement allows the medical viewer engine to manage the insertion of data, images, tags, etc.
In order to maintain the symmetry and organized look of the cells; when a grid has an odd or fewer than the declared row/column number of images, it automatically configures these to insert a blank cells. To further organize these in the way that works for your development, the
CellGridLayout Class can help to define certain parameters.
Built into these blank cells is the ability to _click and add to the cell directly.
As an extension of the
LayoutManager Object, you can use the
emptyDivs Property to identify these cells and remove excess.
The other option is the Random Arrangement.
This option requires that you define the bounds of each cell as you wish, albeit without some of the properties, methods, and commands that are managed by the Medical Viewer in Grid view.
This will require more coding, but will provide precision manipulation from a development standpoint.
In your described scenario, where you are wanting these excess cells removed to limit or even eliminate the cells, you will need to follow the logic provided in the pseudo code from below. (please note that this in written in C# but the logic is the focus)
What this code logic does, is identify the cell count to adjust the grid view accordingly.
Essentially, anytime that the collection of cells is an odd number, the row is reduced down to 1 so that all are displayed.
This should be checked on both the add and remove events that you create (possibly including the invalidate() method as described in ‘b’).
Code:public void medicalViewerCells()
{
int activeCells = medicalViewer.Cells.Count();
if ((activeCells % 2) == 1)
{
if (medicalViewer.Cells.Count() == 3)
{
medicalViewer.Rows = 1;
medicalViewer.Columns = 3;
}
else
{
medicalViewer.Columns = medicalViewer.Cells.Count();
medicalViewer.Rows = 1;
//If one blank cell at the end of the last row is acceptable -
//then replace the two lines above with the two lines below
//(((medicalViewer.Cells.Count()) / 2) + 1);
//medicalViewer.Rows = ((medicalViewer.Cells.Count()) / medicalViewer.Columns);
}
}
else if ((activeCells % 2) == 0)
{
if (medicalViewer.Cells.Count() == 2)
{
medicalViewer.Rows = 1;
medicalViewer.Columns = 2;
}
else
{
medicalViewer.Columns = ((medicalViewer.Cells.Count()) / 2);
medicalViewer.Rows = ((medicalViewer.Cells.Count()) / medicalViewer.Columns);
}
}
}
b)
To redraw the medical viewer you can add an invalidate() Method to the logic operations since this will update the view anytime a cell is either removed or added.
Additional ReferencesLeadtools.Controls.Medical Namespace
https://www.leadtools.co...script/cm/namespace.htmlChris Thompson
Developer Support Engineer
LEAD Technologies, Inc.