Clear images from RenderWindowControl C# Activize.Net - vtk

I am using RenderWindowControl in order to display Dicom Series.
This way:
string folder = path;//#"C:\VTKdata";
vtkDICOMImageReader reader = vtkDICOMImageReader.New();
reader.SetDirectoryName(folder);
reader.Update();
// Visualize
_ImageViewer1 = vtkImageViewer2.New();
_ImageViewer1.SetInputConnection(reader.GetOutputPort());
_ImageViewer1.SetRenderWindow(renderWindow);
_ImageViewer1.SetSlice(_MinSlice1);
_ImageViewer1.Render();
I need to be able to delete all images displayed by the control, before the user reloads a new series.
Any help?
Thanks.

Clear the renderwindow by
_ImageViewer1.SetRenderWindow(null);
renderWindow.Render();
and simply connect it again if new data is available
_ImageViewer1.SetRenderWindow(renderWindow);
_ImageViewer1.Render();

Related

How can I manipulate the Audit screen (SM205510) through code

I'm trying to manipulate the Audit screen (SM205510) through code, using a graph object. The operation of the screen has processes that seem to work when a screen ID is selected in the header. This is my code to create a new record:
Using PX.Data;
Using PX.Objects.SM;
var am = PXGraph.CreateInstance<AUAuditMaintenance>();
AUAuditSetup auditsetup = new AUAuditSetup();
auditsetup.ScreenID = "GL301000";
auditsetup = am.Audit.Insert(auditsetup);
am.Actions.PressSave();
Now, when I execute the code above, it creates a record in the AUAuditSetup table just fine - but it doesn't automatically create the AUAuditTable records the way they are auto-generated in the screen (I realize that the records aren't in the database yet) - but how can I get the graph object to auto-generate the AUAuditTable records in the cache the way they are in the screen?
I've tried looking at the source code for the Audit screen - but it just shows blank, like there's nothing there. I look in the code repository in Visual Studio and I don't see any file for AUAuditMaintenance either, so I can't see any process that I could run in the graph object that would populate those AUAuditTable records.
Any help would be appreciated.
Thanks...
If I had such a need, to manipulate Audit screen records, I'd rather create my own graph and probably generate DAC class. Also I'd add one more column UsrIsArtificial and set it to false by default. And then manage them as ordinary records, but each time I'll add something, I'd set field UsrIsArtificial to false.
You can hardly find how that records are managed at graph level because that records are created and handled on on Graph level, but on framework level. Also think twice or even more about design, as direct writing into Audit history may cause confusion for users in the system of what was caused by user, and what was caused by your code. From that point of view I would rather add one more additional table, then add confusion to existing one.
Acumatica support provided this solution, which works beautifully (Hat tip!):
var screenID = "GL301000"; //"SO303000";
var g = PXGraph.CreateInstance<AUAuditMaintenance>();
//Set Header Current
g.Audit.Current = g.Audit.Search<AUAuditSetup.screenID>(screenID);
if (g.Audit.Current == null) //If no Current then insert
{
var header = new AUAuditSetup();
header.ScreenID = screenID;
header.Description = "Test Audit";
header = g.Audit.Insert(header);
}
foreach (AUAuditTable table in g.Tables.Select())
{
table.IsActive = true;
//Sets Current for Detail
g.Tables.Current = g.Tables.Update(table);
foreach (AUAuditField field in g.Fields.Select())
{
field.IsActive = false;
g.Fields.Update(field);
}
}
g.Actions.PressSave();

Add custom id to each path created using freedrawing

I want to know if it is possible to add a custom id to each path created using
canvas.isDrawingMode = true ;
I suppose it should be done if it is possible before the path is created. Is this possible with fabricjs?
thanks
you can use the event "path:created" on canvas.
canvas.on("path:created", function(opt){
opt.path.id = fabric.Object.__uid++
});
this will ensure you a unique id for every path.
fabric.Object.__uid is used to give ids to any element that needs to be referred later (shadows, patterns... )

Raphael SVG Map - Add class, id and select individual paths

I've got an SVG map which draws up perfectly and I've got some (average) code that offers a mouseOver, onClick and mouseOut state. In my finished page, I need to be able to click on different countries on the map and display data relating to that country in a table below it. (data table entry omitted, I've got that bit running on a local server already).
http://jsfiddle.net/dE9cK/
I've taken a snippet of my raphael-map code here to show how I get my map up and running, the full code is in the jsfiddle above:
var rsr = Raphael('SVGmap', '679', '350');
var layer1 = rsr.set();
var path6251 = rsr.path("M-289.826-562.781c-2.617-0.95-3.363-1.923-2.737-3.568c0.506-1.331,2.102-1.962,2.102-0.831 c0,0.303,0.547,1.292,1.216,2.197C-286.882-561.785-286.9-561.718-289.826-562.781z").attr({id: 'path6251',fill: '#909155',label: 'Ebene 1',groupmode: 'layer',parent: 'layer1','stroke-width': '0','stroke-opacity': '1'}).transform("t470,892.401").data('id', 'path6251');
var rsrGroups = [layer1];
layer1.push(
path6251
);
What I need help with is to:
Add a unique ID/name to each path once it has been drawn up (to enable me to target each individual path for the data table - would prefer it if this was the current path name to make it easier to reference - I'm tidying up all path names once I've got this up and working).
Each path has a data id in my JS file but I can't seem to get that to pull through with the path.
Group paths together (I've got Alaska & USA as named paths in my fiddle, would like to know how I would group these two to both become selected/active when either is clicked).
Really appreciate any help anybody can give. Thank you.
You can use node property to get the element and set id to it like below
path6251.node.id = 'p6251';
Use set() method to group elements and perform operations on the set.
Sample code
var group1 = rsr.set();
group1.push(path1);
group1.push(path2);
group1.attr({fill: 'red'}); //will change color of both path1 and path2

iOS7 what is the correct way to create and use SKTextureAtlas?

I'm not sure of the underlying implementation of the texture atlases, so my question is - what is the correct way to deal with pulling textures out of them? I need to loop through various atlases and pull out 64 random textures.
Create a static atlas and reuse the reference to pull out textures?
static SKTextureAtlas *monsterAtlas;
static int monsterCount;
monsterAtlas = [SKTextureAtlas atlasNamed:#"monsters"];
monsterCount = [monsterAtlas textureNames].count;
//pull out a random texture
NSString* textureName = [[monsterAtlas textureNames] objectAtIndex: arc4random()%monsterCount];
SKTexture* texture = [monsterAtlas textureNamed:textureName];
-OR-
create a new atlas every time I need a texture?
SKTextureAtlas *atlas = [SKTextureAtlas atlasNamed:#"monster"];
SKTexture *f1 = [atlas textureNamed:#"monster-walk1.png"];
The reason i'm asking is that with the first approach, my code may be quite unweildy, as I would have 10+ atlas references created. Will this use too much memory?
With the second approach I'm concerned that I will be doing a lot of extra work creating an atlas each time I execute a loop iteration. How should I do this?
Create each atlas once and keep a reference to it.
It's not unweildy if you write a class that manages atlases and gives you access to individual textures.

How To Obtain All the Nodes and Connections After Launching the GMF Project

After launching the GMF project, I get a new window to make my own model.
After placing some nodes and connections, I should calculate according to their attributes. At first, HOW can I obtain all the information of every node and every connection?
First , let's get the relevant editor:
DomainDiagramEditor d= (DomainDiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
Now, you can either get all the editparts in your diagram , getting the relevant model from them:
final List children = d.getDiagramEditPart().getChildren();
gets you a list of EditParts.
Or, you can get the model objects directly with:
EObject element = d.getDiagram().getElement();
EList<EObject> eContents_ = element.eContents();
That gives you a list of all the model objects in the active editor.
Hope that answers your question

Resources