<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Tahoma, sans-serif;">
<div>
<div>
<div>Thanks for replying Dženan. In this case I was trying to print an itk::Point (an image origin) from one utility and read it in another using a shell script. For other reasons I ended up re-writing the first utility so it prints without the [,] format,
so it now works.</div>
<div><br>
</div>
<div>Toby</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Dženan Zukić <<a href="mailto:dzenanz@gmail.com">dzenanz@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Monday, 18 January 2016 16:25<br>
<span style="font-weight:bold">To: </span>Tobias Wood <<a href="mailto:tobias.wood@kcl.ac.uk">tobias.wood@kcl.ac.uk</a>><br>
<span style="font-weight:bold">Cc: </span>"<a href="mailto:community@itk.org">community@itk.org</a>" <<a href="mailto:community@itk.org">community@itk.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [ITK] itk::Point extraction operator<br>
</div>
<div><br>
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
Hi Tobias,</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
the >> operator is meant to be used for human provided input, while << operator tries to have a nice formatting. Correctly passing points through streams was obviously not considered frequent/important use-case.</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br>
</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
Regards,</div>
<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
Dženan</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jan 18, 2016 at 5:19 AM, Wood, Tobias <span dir="ltr">
<<a href="mailto:tobias.wood@kcl.ac.uk" target="_blank">tobias.wood@kcl.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
While trying to read an itk::Point from stdin, I noticed that the insertion and extraction operators are asymmetric. The insertion operator adds [] round the point and uses commas for delimiters. The extraction operator only expects numbers with white-space
as the delimiter. Hence the following code:<br>
<br>
itk::Point<float, 3> A; A[0] = 1.; A[1] = 2.; A[2] = 3.;<br>
itk::Point<float, 3> B;<br>
std::stringstream stream;<br>
stream << A;<br>
stream >> B;<br>
std::cout << "A = " << A << std::endl;<br>
std::cout << "B = " << B << std::endl;<br>
<br>
<br>
Produces this as output:<br>
<br>
A = [1, 2, 3]<br>
B = [0, 0, 0]<br>
<br>
<br>
with no errors or exceptions thrown.<br>
<br>
Is this intended behaviour? It was counter-intuitive to me - but in my experience dealing with formatted input via the extraction operator is a complete pain so I can understand why it was written like this! I found an interesting workaround which involves
a custom locale on this Stack Overflow page - <a href="http://stackoverflow.com/questions/1894886/parsing-a-comma-delimited-stdstring" rel="noreferrer" target="_blank">
http://stackoverflow.com/questions/1894886/parsing-a-comma-delimited-stdstring</a><br>
<br>
Best wishes,<br>
Toby<br>
_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</span>
</body>
</html>