Hexagon Geospatial
MENU

Smart M.App

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 106
Registered: ‎06-04-2016
Accepted Solution

Piecing together processed subsets of the original image

[ Edited ]

So the Clump operator washes out the top of the image and there is no Rotation operator that would allow me to compensate by piecing together the lower half of one Clumped raster with the lower half of a rotated raster.

 

I tried improvising..., but before I get into how, a note on why. Essentially I'm trying to use processed copies of an image as a mask to remove pixels I'm not interested in.

 

Model https://db.tt/isVb0v14. The alternative solution I tried involved piping the RasterInput to RasterInformation to get the size of the image, which was then piped to 2 DefineProcessingArea (DPA) operators that (insofar as I understand) essentially set an AOI - one for the top half of the image and another for the lower half. These areas could be tuned to overlap a bit to mitigate the washout. The origin for the top DPA is <0,0> while the origin for the lower DPA is <0,H/2>, which ensures each AOI maintains its relative position wrt the orginal raster. Anyhow, the ourput of each DPA is piped to its own Clump op, whose outputs are subtracted from the original image (to maintain the original raster size). I then Added the results and output the Raster. 

 

There were a number of issues with this approach. [a] each DPA operator yielded a raster with a different size than the original (Orig = 4792x7200 u1, DPA = 18506x13903 u1). To compensate, I used a 3rd DPA on the original image (18506x27806 u1) and Subtracted clumped results from that. That's incomplete because I really want to subtract from each half of the original. [b] Each Subtract yielded a raster (18506x13903 u1) but the Add op yielded (18506x0 s32), which caused RasterOutput to error out.

 

[0] How are the AOIInput and ApplyAOI operators used?

[1] How do you clip and piece images together? 

[2] Why did DPA change the size of the raster, when I defined the size using the TX,TY, LX,LY properties?

[3] What raster data-generation options are available? If, for example, I could generate a blank raster the same size as my original with the top-half black and lower-half white, I could use a Boolean operation to isolate half of my image. Alternatively, if I could paste my original image inside a much larger image-space, it might be possible to avoid washout.

[4] How is the CreateGeometryFromAttributes operator used?

 

 

Regards

Highlighted
Staff
Posts: 119
Registered: ‎07-04-2016

Re: Piecing together processed subsets of the original image

[ Edited ]

Dear Noel,

 

1) You can merge images together using following model:

 

1.png

 

Simply I am replacing here NoData values of the 1st image with the values of the 2nd image. Using the tool DefineProcessingArea I am specifying to use the Union of inputs for this process to add all 2nd image on a place of NoData of the first.

 

 

Also, you can look for more information regarding subsetting using DPA in Spatial Recipes: http://community.hexagongeospatial.com/t5/Spatial-Recipes/Subset-Image-by-Polygonal-Geometries-2016/...

 

 

You can also clip your image using AOI

 

 

The Apply AOI operator applies an AOI to the input Raster. This either includes or excludes the pixels within the AOI, determined by whether the Invert port is set to true or false.

 

2.png

 

If in the Invert section you will write – false, so the operator will subset the image within the AOI.

 

3.png

If true, in my case, I will have a hole where AOI was.

 

4.png

 

 

 

Regards,

Marina

 

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support
Technical Evangelist
Posts: 29
Registered: ‎01-29-2016

Re: Piecing together processed subsets of the original image

Clump does not "wash out" the top of the image. It assigns dark colors to the top of the image, as I explained in your "Notes on Clump" thread.

 

You need to apply a different color scheme if you wish to visually distinguish between clunmps near tho top.

 Example (done in IMAGINE) attached.

Technical Evangelist
Posts: 29
Registered: ‎01-29-2016

Re: Piecing together processed subsets of the original image

Note clump2.jpg is the contents of the "Random Colors" sub-model of clump1.jpg

Frequent Contributor
Posts: 106
Registered: ‎06-04-2016

Re: Piecing together processed subsets of the original image

Hi Larry, 

 

Thanks for the clarification.

 

Would you happen to still have the gdmx file?

 

I tried to replicate (https://db.tt/49AVhKSW) and got an error message: 

 

 

Intergraph::SpatialModeler::Operator::Execute failed
Intergraph::SpatialModeler::Operator::SetErrorMessage failed
Spatial Model failed in RasterOutput.  The error was "erdas::raster::CreatableGridCoverageFormatEIMG::TransferAttributeTables failed
edsc_ColumnWrite failed
Invalid range of row numbers specified:  2000 - 2000".

INFO  [SWF Activity  Generic 1] 2016-07-11 19:44:13,134 813af0cf-910f-4792-87a5-7b801ad8f0d2 Imagine log output: Running spatial model (C:/Windows/TEMP/SMPROCESS_MODEL146826624877211).

Intergraph::SpatialModeler::Operator::Execute failed
Intergraph::SpatialModeler::Operator::SetErrorMessage failed
Spatial Model failed in RasterOutput.  The error was "erdas::raster::CreatableGridCoverageFormatEIMG::TransferAttributeTables failed
edsc_ColumnWrite failed
Invalid range of row numbers specified:  2000 - 2000".

FATAL [SWF Activity  Generic 1] 2016-07-11 19:44:13,134 813af0cf-910f-4792-87a5-7b801ad8f0d2 Execution failed with java.lang.Exception: Model execution '"C:\Program Files\Hexagon\Spatial Modeler Runtime 2016\bin\x64URelease\NCSRunModel.exe" A 813af0cf-910f-4792-87a5-7b801ad8f0d2 "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\813af0cf-910f-4792-87a5-7b801ad8f0d2.gmdx" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\input.json" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d22110141487171841636_output.json"' did not complete successfully. Exit value: 1 Message: {"Status":"Job Started"}

java.lang.Exception: Model execution '"C:\Program Files\Hexagon\Spatial Modeler Runtime 2016\bin\x64URelease\NCSRunModel.exe" A 813af0cf-910f-4792-87a5-7b801ad8f0d2 "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\813af0cf-910f-4792-87a5-7b801ad8f0d2.gmdx" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\input.json" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d22110141487171841636_output.json"' did not complete successfully. Exit value: 1 Message: {"Status":"Job Started"}

	at com.hexagon.windmill.util.spatialmodel.smclib.ExecuteAsynchronousModel(smclib.java:211)
	at com.hexagon.windmill.workflows.swfgeoprocessing.swf.GeoprocessingActivitiesImpl.ExecuteModel(GeoprocessingActivitiesImpl.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.amazonaws.services.simpleworkflow.flow.pojo.POJOActivityImplementation.execute(POJOActivityImplementation.java:64)
	at com.amazonaws.services.simpleworkflow.flow.generic.ActivityImplementationBase.execute(ActivityImplementationBase.java:46)
	at com.amazonaws.services.simpleworkflow.flow.worker.SynchronousActivityTaskPoller.execute(SynchronousActivityTaskPoller.java:196)
	at com.amazonaws.services.simpleworkflow.flow.worker.ActivityTaskPoller$2.run(ActivityTaskPoller.java:92)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
FATAL [SWF Activity  Generic 1] 2016-07-11 19:44:13,134 813af0cf-910f-4792-87a5-7b801ad8f0d2 Execution failed with java.lang.Exception: Model execution '"C:\Program Files\Hexagon\Spatial Modeler Runtime 2016\bin\x64URelease\NCSRunModel.exe" A 813af0cf-910f-4792-87a5-7b801ad8f0d2 "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\813af0cf-910f-4792-87a5-7b801ad8f0d2.gmdx" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\input.json" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d22110141487171841636_output.json"' did not complete successfully. Exit value: 1 Message: {"Status":"Job Started"}

java.lang.Exception: Model execution '"C:\Program Files\Hexagon\Spatial Modeler Runtime 2016\bin\x64URelease\NCSRunModel.exe" A 813af0cf-910f-4792-87a5-7b801ad8f0d2 "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\813af0cf-910f-4792-87a5-7b801ad8f0d2.gmdx" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d2\input.json" "C:\Windows\TEMP\813af0cf-910f-4792-87a5-7b801ad8f0d22110141487171841636_output.json"' did not complete successfully. Exit value: 1 Message: {"Status":"Job Started"}

	at com.hexagon.windmill.util.spatialmodel.smclib.ExecuteAsynchronousModel(smclib.java:211)
	at com.hexagon.windmill.workflows.swfgeoprocessing.swf.GeoprocessingActivitiesImpl.ExecuteModel(GeoprocessingActivitiesImpl.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.amazonaws.services.simpleworkflow.flow.pojo.POJOActivityImplementation.execute(POJOActivityImplementation.java:64)
	at com.amazonaws.services.simpleworkflow.flow.generic.ActivityImplementationBase.execute(ActivityImplementationBase.java:46)
	at com.amazonaws.services.simpleworkflow.flow.worker.SynchronousActivityTaskPoller.execute(SynchronousActivityTaskPoller.java:196)
	at com.amazonaws.services.simpleworkflow.flow.worker.ActivityTaskPoller$2.run(ActivityTaskPoller.java:92)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Regards

Frequent Contributor
Posts: 106
Registered: ‎06-04-2016

Re: Piecing together processed subsets of the original image

Thank you Marina.

 

I'll play around with your examples and the reference.

 

Regards

Technical Evangelist
Posts: 29
Registered: ‎01-29-2016

Re: Piecing together processed subsets of the original image

Attached is zip containing json that should be uploadable in Spatial Workshop

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.